power shell v2 en action - avec posh board 2.0

23
1 Windows PowerShell V2 en action Patrick Guimonet Architecte Microsoft France http://blogs.technet.com/power shell Antoine Habert MVP PowerShell Nelite http://www.devinfra.blogspo t.com /

Upload: patrick-guimonet

Post on 01-Jun-2015

2.923 views

Category:

Business


0 download

DESCRIPTION

Sesison du 7/10/2009 à Issy les Moulineaux

TRANSCRIPT

Page 1: 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/

Page 2: Power Shell V2 en action - avec Posh Board 2.0

2

AgendaWindows PowerShell V2 en action

IntroductionNouvelles fonctionnalités

Démo 1 : Interface graphique & PowerShellDémo 2Démo 3Démo 4

PoshBoard V2Conclusion

Page 3: Power Shell V2 en action - avec Posh Board 2.0

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

Page 4: Power Shell V2 en action - avec Posh Board 2.0

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é

Page 5: Power Shell V2 en action - avec Posh Board 2.0

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

Page 6: Power Shell V2 en action - avec Posh Board 2.0

6

Thèmes PowerShell 2.0

Scripts de production

Environnement automatisé

Langage & Cmdlets

Interface graphique & PowerShell

Page 7: Power Shell V2 en action - avec Posh Board 2.0

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

Page 8: Power Shell V2 en action - avec Posh Board 2.0

8

Démo 1Interface graphique & PowerShell

Page 9: Power Shell V2 en action - avec Posh Board 2.0

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

Page 10: Power Shell V2 en action - avec Posh Board 2.0

11

Démo 2Scripts de production :

Fonctions avancéesModulesAide

Page 11: Power Shell V2 en action - avec Posh Board 2.0

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

Page 12: Power Shell V2 en action - avec Posh Board 2.0

15

Démo 3Environnement automatisé :

JobsExécution à distanceEvènements

Page 13: Power Shell V2 en action - avec Posh Board 2.0

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++

Page 14: Power Shell V2 en action - avec Posh Board 2.0

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

Page 15: Power Shell V2 en action - avec Posh Board 2.0

18

Démo 4Un dernier exemple…

Page 16: Power Shell V2 en action - avec Posh Board 2.0

19

Démo 5PoshBoard V2par Antoine HabertMVP PowerShell

Page 17: Power Shell V2 en action - avec Posh Board 2.0

© 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

Page 18: Power Shell V2 en action - avec Posh Board 2.0

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

Page 19: Power Shell V2 en action - avec Posh Board 2.0

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

Page 20: Power Shell V2 en action - avec Posh Board 2.0

DÉMONSTRATION POSHBOARD 2.0

23

Page 21: Power Shell V2 en action - avec Posh Board 2.0

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)

Page 22: Power Shell V2 en action - avec Posh Board 2.0

25

Questions / Réponses

Page 23: Power Shell V2 en action - avec Posh Board 2.0

© 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