Power Shell V2 en action - avec Posh Board 2.0
-
Upload
patrick-guimonet -
Category
Business
-
view
2.927 -
download
0
description
Transcript of Power Shell V2 en action - avec Posh Board 2.0
1
Windows PowerShell V2 en action
Patrick GuimonetArchitecteMicrosoft Francehttp://blogs.technet.com/powershell
Antoine HabertMVP PowerShell
Nelitehttp://www.devinfra.blogspot.com/
2
AgendaWindows PowerShell V2 en action
IntroductionNouvelles fonctionnalités
Démo 1 : Interface graphique & PowerShellDémo 2Démo 3Démo 4
PoshBoard V2Conclusion
3
• Inspiré des langages de scripts UNIX : ksh, bash, perl, …• Mais spécifiquement Windows car reposant sur l'environnement .Net• Syntaxe proche du C#• Tous les produits serveurs de Microsoft doivent supporter PowerShell
Windows PowerShellLe langage de lignes de commande et de scripts
4
Exchange 2003 (VBScript) Exchange 2007 (PowerShell)
Mailbox Statistics
Set listExchange_Mailboxs = GetObject("winmgmts:{impersonationLevel=impersonate}!\\COMPUTERNAME\ROOT\MicrosoftExchangeV2").InstancesOf("Exchange_Mailbox")
For Each objExchange_Mailbox in listExchange_MailboxsWScript.echo "AssocContentCount =” + objExchange_Mailbox.AssocContentCountWScript.echo " DateDiscoveredAbsentInDS =” + objExchange_Mailbox.DateDiscoveredAbsentInDSWScript.echo " DeletedMessageSizeExtended =” + objExchange_Mailbox. DeletedMessageSizeExtendedWScript.echo " LastLoggedOnUserAccount =” + objExchange_Mailbox. LastLoggedOnUserAccountWScript.echo " LastLogoffTime =” + objExchange_Mailbox. LastLogoffTimeWScript.echo " LastLogonTime =” + objExchange_Mailbox. LastLogonTime WScript.echo " LegacyDN =” + objExchange_Mailbox. LegacyDNWScript.echo " MailboxDisplayName =” + objExchange_Mailbox. MailboxDisplayNameWScript.echo " MailboxGUID =” + objExchange_Mailbox. MailboxGUID WScript.echo " ServerName =” + objExchange_Mailbox. ServerName WScript.echo " Size =” + objExchange_Mailbox. SizeWScript.echo " StorageGroupName =” + objExchange_Mailbox. StorageGroupName WScript.echo " StorageLimitInfo =” + objExchange_Mailbox. StorageLimitInfo WScript.echo " StoreName =” + objExchange_Mailbox. StoreName WScript.echo " TotalItems =” + objExchange_Mailbox. TotalItems Next
Get-MailboxStatistics –Server $servername
Database Mgmt
Dim StorGroup as New CDOEXM.StorageGroup
StorGroup.DataSource.Open "LDAP://" + DCServer + "/ CN=First Storage Group,CN=InformationStore,CN=" + Server + ",CN=Servers,CN=First Administrative Group, CN=Administrative Groups,CN=First Organization, CN=Microsoft Exchange,CN=Services, CN=Configuration," + DomainName
StorGroup.MoveLogFiles("C:\newlogPath", 0)
Move-StorageGroupPath -Identity “First Storage Group“ –Log "C:\newlogPath”
Recipient Mgmt
Dim objMailbox As CDOEXM.IMailboxStore
Set objMailbox = GetObject("LDAP://" + DCServer + "CN=FOO,CN=users," + DomainName)
objMailbox.CreateMailbox "LDAP://" + DCServer + "/CN=Private MDB,CN=First Storage Group,CN=InformationStore,CN=" + Server + ",CN=Servers,CN=First Administrative Group, CN=Administrative Groups,CN=First Organization, CN=Microsoft Exchange,CN=Services, CN=Configuration," + DomainName
Enable-Mailbox -Identity domain\FOO –Database “First Storage Group\Private MDB”
Productivité
5
Architecture de PowerShell
Expérience utilisateur
Shell
Langage
Debugger
Moteur
APIs
Contexte d'exécution
Gestionnnaire d'objets
Eléments gérés
Cmdlets
WMI
COM
.NET
XML
ADO
ADSI
Commandes natives
6
Thèmes PowerShell 2.0
Scripts de production
Environnement automatisé
Langage & Cmdlets
Interface graphique & PowerShell
7
Interface graphique & PowerShell
Expérience utilisateur
Shell
Langage
Debugger
Moteur
APIs
Contexte d'exécution
Gestionnnaire d'objets
Eléments gérés
Cmdlets
WMI
COM
.NET
XML
ADO
ADSI
Commandes natives
Console graphique
Out-Gridview
Nouvelles APIs
PSSession Pooling
Contrôle de Thread
Bibliothèques graphiques
8
Démo 1Interface graphique & PowerShell
10
Scripts de production
Expérience utilisateur
Shell
Langage
Debugger
Moteur
APIs
Contexte d'exécution
Gestionnnaire d'objets
Eléments gérés
Cmdlets
WMI
COM
.NET
XML
ADO
ADSI
Commandes natives
Restricted Language
Modules
Debugger
Transactions
Code natif
Fonctions avancées
Fonctions avancées
11
Démo 2Scripts de production :
Fonctions avancéesModulesAide
12
Environnement automatisé
Expérience utilisateur
Shell
Langage
Debugger
Moteur
APIs
Contexte d'exécution
Gestionnnaire d'objets
Eléments gérés
Cmdlets
WMI
COM
.NET
XML
ADO
ADSI
Commandes natives
Execution à distance
Jobs
Evènements
Sessions restraintes
Mobile Object Model
15
Démo 3Environnement automatisé :
JobsExécution à distanceEvènements
16
Retours de la communauté
Expérience utilisateur
Shell
Langage
Debugger
Moteur
APIs
Contexte d'exécution
Gestionnnaire d'objets
Eléments gérés
Cmdlets
WMI
COM
.NET
XML
ADO
ADSI
Commandes natives
Améliorations du langage
Adaptateurs d'objets
améliorés
Nouvelles Cmdlets
WMI++
17
Nouvelles Cmdlets ….Remoting:
Invoke-CommandNew-PSSessionGet-PSSessionPush-PSSessionPop-PSSessionRemove-PSSession
Converting Types:Add-TypeConvertTo-CsvConvertFrom-CsvConvertTo-XmlConvertFrom-StringData
Event Viewer and ETW Logs:Get-Event
Script Internationalization:Import-LocalizedData
Modules:Imort-ModuleGet-ModuleRemove-ModuleExport-ModuleMember
Transactions:Complete-TransactionStart-TransactionUndo-TransactionUse-Transaction
Debugging:Set-PSBreakpoint
Get-PSBreakpoint
Enable-PSBreakpoint
Disable-PSBreakpoint
Remove-PSBreakpoint
Get-PSCallStack
Eventing:Register-ObjectEvent
Register-Event
Wait-Event
Remove-Event
Unregister-Event
Get-Event
New-Event
Get-EventSubscriber
Background Jobs:Start-Job
Get-Job
Stop-Job
Receive-Job
Wait-Job
Remove-Job
WMI:Register-WMIEvent Set-WMIInstanceInvoke-WMIMethodRemove-WMIObject
More Cmdlets:Clear-HistoryGet-RandomOut-GridViewSet-StrictModeUpdate-ListWait-Process
ComputerAdd-ComputerCheckpoint-ComputerDisable-ComputerRestoreEnable-ComputerRestoreGet-ComputerRestorePointRemove-ComputerRename-ComputerReset-ComputerMachinePasswordRestart-ComputerRestore-ComputerStop-ComputerTest-ComputerSecureChannel
18
Démo 4Un dernier exemple…
19
Démo 5PoshBoard V2par Antoine HabertMVP PowerShell
© 2008 Nelite
Nelite Consulting Services
7 Octobre 2009
Antoine HabertArchitecte Infrastructure et développementMVP PowerShell
PoshBoard 2.0-Présentation des nouveautés
MS Days 2009
21
Qu’est ce que PoshBoardPortail IT open source basé sur PowerShell (1.0 et 2.0), Silverlight et ASP.NET
http://poshboard.codeplex.comhttp://www.poshboard.com
Permet la génération d’élément graphique Silverlight à partir de code PowerShell (Graphiques, tableaux…)
Utilisé pour :Génération de rapport statistiques (Hard / Soft, Virtualisation, annuaires, System Center…)Création d’interface de gestion (Provisioning, exploitation…)
21
22
PoshBoard 2.0 Nouveautés du portail :
Portail ré-écrit from scratchBasé sur Silverlight 3 et CustomBinding WCFAuthentification Windows integréeGestion des accès aux différentes pages par role (administrateur / visiteur…)Prise en charge de la délégation / impersonificationPermet une sortie dynamique des résultat de script en mode console
Nouveautés Snapin PowerShell :Modèle objet unifié pour l’ensemble des contrôles SilverlightsNouveaux cmdlets (Out-PBDatagrid, New-PBCoverFlow, New-PBTab…)PoshBoard propose maintenant 23 cmdlets
22
DÉMONSTRATION POSHBOARD 2.0
23
24
Et ensuite ?
S’informer sur Powershellhttp://blogs.technet.com/powershellhttp://blogs.msdn.com/powershell
Blog d'Antoine Haberthttp://www.devinfra.blogspot.com
Télécharger la versionhttp://blogs.msdn.com/powershell (en haut à droite)
25
Questions / Réponses
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED
OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Votre potentiel, notre passion TM