Advanced Automation UsingWindows PowerShell 2.0WSV406Jeffrey SnoverDistinguished EngineerMicrosoftDan HarmanSenior Program ManagerMicrosoft
Session OverviewTechnical Level:  400Intended Audience:  IT administrators and scriptersLearning Objectives:Learn about improvements to Windows PowerShell 2.0Understand how to use advanced scripting techniquesSee how PowerShell features work in common scenariosPresentation Outline:Overview of new PowerShell 2.0 featuresAdvanced scripting techniques in depthGUI over PowerShell demoProduction scripting demoUniversal automation environment demo
Improvements in PowerShell 2.0Dozens of big featuresRemotingPowerShell ISEAdvanced FunctionsBackground JobsRestricted SessionsTransactionsOut-GridViewScript DebuggingNew & Improved CmdletsHosting APIsModulesEventingSession PoolsLanguage EnhancementsWMI ImprovementsImproved AD AdapterPerformance ImprovementsScript InternationalizationParser API SupportMore…
PowerShell Architecture
PowerShell 2.0 ThemesProduction ScriptingUniversal Automation EnvironmentGUI over PowerShellLanguage and Cmdlets
GUI Over PowerShellLayering admin GUIs on top of PowerShellDrives consistency between CLI & GUIEnables agility in delivering new GUIsGuarantees automation of GUI commandsFacilitates GUI teaching command lineStandardizes access to managed elementsGUI over PowerShell
GUI Over PowerShell FeaturesPowerShell ISEOut-GridViewHosting APIsSession PoolingThread Control
demoGUI Over PowerShellDan HarmanSenior Program ManagerWindows PowerShell
Production ScriptingProduction ScriptingScripts are:Easy to useEasy to shareEasy to supportSafe to operate
Production Scripting FeaturesAdvanced FunctionsAdvanced FunctionsNative CodeDebugger EnhancementsRestricted LanguageModulesTransactions
Advanced FunctionsGives the power of authoring custom cmdlets to IT prosWrite PowerShell cmdlets using script instead of compiled codeEnables consistent syntax and semantics between functions & cmdletsEvolution of function syntax from PowerShell 1.0Near parity with .NET cmdlet capabilitiesParameter attributesRangeLengthNot NullNot Null or EmptyPatternSetCountScriptCmdlet attributes-SupportsShouldProcess-ConfirmImpact  {  Low | Medium | High  }$PSCmdlet similar to 'this' in C#$PSCmdlet.ShouldProcess("Target", "Action")$PSCmdlet.ShouldContinue("Query", "Caption")Support inline help or external PSMAML help
demoProduction ScriptingAdvanced FunctionsJeffrey SnoverDistinguished EngineerWindows PowerShell
demoProduction ScriptingModulesDan HarmanSenior Program ManagerWindows PowerShell
Universal Automation EnvironmentInteractive or programmaticIn the foreground or backgroundLocal or remoteSingle machine or multiple machinesSynchronous or asynchronousIn restricted or unrestricted environmentsWide range of authentication mechanismsSimple scripting to systems programmingUniversal Automation Environment
Automation Environment FeaturesRemotingBackground JobsEventingRestricted SessionsMobile Object Model
Remoting Scenarios1:Many (fan-out): Large Scale AutomationSend the script to remote machinesSelect properties - allows client to specify which properties to returnThrottling - limits the number of concurrent operationsJob support - runs commands in the background on client1:1 (interactive): Secure Telnet ReplacementCmdlet equivalent of Remote DesktopInteract with a remote machine as if it were localNo Invoke-Command requiredIdeal for troubleshooting a remote machineMany:1 (fan-in): Delegated Administration & HostingHosting model for web servicesNo tools installation required on clientConstrained session environment (cmdlets, parameters, language)
demoUniversal Automation EnvironmentRemotingJeffrey SnoverDistinguished EngineerWindows PowerShell
demoUniversal Automation EnvironmentBackground JobsDan HarmanSenior Program ManagerWindows PowerShell
Language and CmdletsResponding to community feedbackEnhance the languageImprove the engineProvide more built-in cmdletsLanguage and Cmdlets
Language and CmdletsNew CmdletsWMI++LanguageEnhancementsImprovedObject Adapters
Over 100 New Built-In CmdletsHundreds more from partnersModulesExport-ModuleMemberGet-ModuleImport-ModuleNew-ModuleNew-ModuleManifestRemove-ModuleTest-ModuleManifestEventingGet-EventGet-EventSubscriberNew-EventRegister-EngineEventRegister-ObjectEventRemove-EventUnregister-EventWait-EventWS-ManConnect-WSManDisable-WSManCredSSPDisconnect-WSManEnable-WSManCredSSPGet-WSManCredSSPGet-WSManInstanceInvoke-WSManActionNew-WSManInstanceNew-WSManSessionOptionRemove-WSManInstanceSet-WSManInstanceSet-WSManQuickConfigTest-WSManTransactionsComplete-TransactionGet-TransactionStart-TransactionUndo-TransactionUse-TransactionDebuggingDisable-PSBreakpointEnable-PSBreakpointGet-PSBreakpointGet-PSCallStackRemove-PSBreakpointSet-PSBreakpointType ConversionAdd-TypeConvertFrom-CsvConvertFrom-StringDataConvertTo-CsvConvertTo-XmlDiagnosticsClear-EventLogExport-CounterGet-CounterGet-HotfixGet-WinEventImport-CounterLimit-EventLogNew-EventLogRemove-EventLogShow-EventLogWrite-EventLogComputersAdd-ComputerCheckpoint-ComputerDisable-ComputerRestoreEnable-ComputerRestoreGet-ComputerRestorePointRemove-ComputerReset-ComputerPasswordRestart-ComputerRestore-ComputerStop-ComputerTest-ConnectionWMIInvoke-WMIMethodRegister-WMIEventRemove-WMIObjectSet-WMIInstanceOtherClear-HistoryDebug-ProcessExport-FormatDataGet-FormatDataGet-RandomImport-LocalizedDataOut-GridViewSelect-XmlSend-MailMessageSet-StrictModeStart-ProcessTest-ComputerSecureChannelUpdate-ListWait-ProcessRemotingDisable-PSSessionConfigurationEnable-PSSessionConfigurationEnable-PSRemotingEnter-PSSessionExit-PSSessionExport-PSSessionGet-PSSessionGet-PSSessionConfigurationImport-PSSessionInvoke-CommandNew-PSSessionNew-PSSessionOptionNew-WebServiceProxyRegister-PSSessionConfigurationRemove-PSSessionSet-PSSessionConfigurationCustom SessionsDisable-PSSessionConfigurationEnable-PSSessionConfigurationGet-PSSessionConfigurationNew-PSSessionOptionRegister-PSSessionConfigurationSet-PSSessionConfigurationUnregister-PSSessionConfigurationBackground JobsGet-JobReceive-JobRemove-JobStart-JobStop-JobWait-Job
16 New Partners in Windows 7 & WS08 R2Many active internal partnersExchange Server • Windows Diagnostics • Server Manager • SQL Server • Active Directory • Failover Clustering • System Center Operations Manager • Windows Backup • Server Migration • System Center Virtual Machine Manager • Best Practices Analyzer • Active Directory Rights Management Services • Internet Information Services • Background Intelligent Transfer Service • System Center Data Protection Manager • Network Load Balancing • Remote Desktop Services  •  Group Policy  •  WS-Management •  AppLocker •  WMI
Windows PowerShell Community ResourcesTeam blog:  http://blogs.msdn.com/PowerShellPowerShell Community:  http://www.powershellcommunity.orgPowerShell Forum: http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/threadsChannel 9:  http://channel9.msdn.com/tags/PowerShellWiki: http://channel9.msdn.com/wiki/default.aspx/Channel9.WindowsPowerShellWikiScript Center:  http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspxCodePlex: http://codeplex.com/Project/ProjectDirectory.aspx?TagName=powershellSome good booksPowerShell in Action, 2nd Edition by Bruce Payettehttp://www.manning.com/payette2Windows PowerShell Cookbook, 2nd Edition by Lee Holmes http://oreilly.com/catalog/9780596801519/Professional Windows PowerShell Programming http://www.wrox.com/WileyCDA/WroxTitle/productCd-0470173939.htmlPowerShell Comics! http://borntolearn.mslearn.net/comics/b/weblog/archive/2011/04/20/climbing-mt-powershell-comic-book-first-pages.aspx
Related ContentBreakout SessionsWSV406 | Advanced Automation Using Windows PowerShell 2.0 WSV315 Windows PowerShell for Beginners WCL321 | Windows PowerShell Remoting: Definitely NOT Just for Servers WSV322 | Managing the Registry with Windows PowerShell 2.0WSV471-INT | Build Reusable Tools in Windows PowerShellWSV473-INT | Windows PowerShell 3.0: Why Wait? Get Next-Generation PowerShell…EXL321 | Microsoft Lync Server 2010: Administering Lync Server DeploymentHands-on LabsWSV276-HOL Introduction to Windows PowerShell Fundamentals WSV371-HOL Advanced Windows PowerShell Scripting WSV378-HOL Server Management and Windows PowerShell V2 Product Demo Stations WSV 1 – Windows PowerShell and Server Management
Track ResourcesDon’t forget to visit the Cloud Power area within the TLC (Blue Section) to see product demos and speak with experts about the Server & Cloud Platform solutions that help drive your business forward.You can also find the latest information about our products at the following links:Cloud Power - http://www.microsoft.com/cloud/Private Cloud - http://www.microsoft.com/privatecloud/Windows Server - http://www.microsoft.com/windowsserver/Windows Azure - http://www.microsoft.com/windowsazure/Microsoft System Center - http://www.microsoft.com/systemcenter/Microsoft Forefront - http://www.microsoft.com/forefront/
ResourcesConnect. Share. Discuss.http://northamerica.msteched.comLearningSessions On-Demand & CommunityMicrosoft Certification & Training Resourceswww.microsoft.com/techedwww.microsoft.com/learningResources for IT ProfessionalsResources for Developershttp://microsoft.com/technethttp://microsoft.com/msdn
Complete an evaluation on CommNet and enter to win!
© 2011 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.

Wsv406 Advanced Automation Using Windows Power Shell2.0

  • 2.
    Advanced Automation UsingWindowsPowerShell 2.0WSV406Jeffrey SnoverDistinguished EngineerMicrosoftDan HarmanSenior Program ManagerMicrosoft
  • 3.
    Session OverviewTechnical Level: 400Intended Audience: IT administrators and scriptersLearning Objectives:Learn about improvements to Windows PowerShell 2.0Understand how to use advanced scripting techniquesSee how PowerShell features work in common scenariosPresentation Outline:Overview of new PowerShell 2.0 featuresAdvanced scripting techniques in depthGUI over PowerShell demoProduction scripting demoUniversal automation environment demo
  • 4.
    Improvements in PowerShell2.0Dozens of big featuresRemotingPowerShell ISEAdvanced FunctionsBackground JobsRestricted SessionsTransactionsOut-GridViewScript DebuggingNew & Improved CmdletsHosting APIsModulesEventingSession PoolsLanguage EnhancementsWMI ImprovementsImproved AD AdapterPerformance ImprovementsScript InternationalizationParser API SupportMore…
  • 5.
  • 6.
    PowerShell 2.0 ThemesProductionScriptingUniversal Automation EnvironmentGUI over PowerShellLanguage and Cmdlets
  • 7.
    GUI Over PowerShellLayeringadmin GUIs on top of PowerShellDrives consistency between CLI & GUIEnables agility in delivering new GUIsGuarantees automation of GUI commandsFacilitates GUI teaching command lineStandardizes access to managed elementsGUI over PowerShell
  • 8.
    GUI Over PowerShellFeaturesPowerShell ISEOut-GridViewHosting APIsSession PoolingThread Control
  • 9.
    demoGUI Over PowerShellDanHarmanSenior Program ManagerWindows PowerShell
  • 10.
    Production ScriptingProduction ScriptingScriptsare:Easy to useEasy to shareEasy to supportSafe to operate
  • 11.
    Production Scripting FeaturesAdvancedFunctionsAdvanced FunctionsNative CodeDebugger EnhancementsRestricted LanguageModulesTransactions
  • 12.
    Advanced FunctionsGives thepower of authoring custom cmdlets to IT prosWrite PowerShell cmdlets using script instead of compiled codeEnables consistent syntax and semantics between functions & cmdletsEvolution of function syntax from PowerShell 1.0Near parity with .NET cmdlet capabilitiesParameter attributesRangeLengthNot NullNot Null or EmptyPatternSetCountScriptCmdlet attributes-SupportsShouldProcess-ConfirmImpact { Low | Medium | High }$PSCmdlet similar to 'this' in C#$PSCmdlet.ShouldProcess("Target", "Action")$PSCmdlet.ShouldContinue("Query", "Caption")Support inline help or external PSMAML help
  • 13.
    demoProduction ScriptingAdvanced FunctionsJeffreySnoverDistinguished EngineerWindows PowerShell
  • 14.
    demoProduction ScriptingModulesDan HarmanSeniorProgram ManagerWindows PowerShell
  • 15.
    Universal Automation EnvironmentInteractiveor programmaticIn the foreground or backgroundLocal or remoteSingle machine or multiple machinesSynchronous or asynchronousIn restricted or unrestricted environmentsWide range of authentication mechanismsSimple scripting to systems programmingUniversal Automation Environment
  • 16.
    Automation Environment FeaturesRemotingBackgroundJobsEventingRestricted SessionsMobile Object Model
  • 17.
    Remoting Scenarios1:Many (fan-out):Large Scale AutomationSend the script to remote machinesSelect properties - allows client to specify which properties to returnThrottling - limits the number of concurrent operationsJob support - runs commands in the background on client1:1 (interactive): Secure Telnet ReplacementCmdlet equivalent of Remote DesktopInteract with a remote machine as if it were localNo Invoke-Command requiredIdeal for troubleshooting a remote machineMany:1 (fan-in): Delegated Administration & HostingHosting model for web servicesNo tools installation required on clientConstrained session environment (cmdlets, parameters, language)
  • 18.
    demoUniversal Automation EnvironmentRemotingJeffreySnoverDistinguished EngineerWindows PowerShell
  • 19.
    demoUniversal Automation EnvironmentBackgroundJobsDan HarmanSenior Program ManagerWindows PowerShell
  • 20.
    Language and CmdletsRespondingto community feedbackEnhance the languageImprove the engineProvide more built-in cmdletsLanguage and Cmdlets
  • 21.
    Language and CmdletsNewCmdletsWMI++LanguageEnhancementsImprovedObject Adapters
  • 22.
    Over 100 NewBuilt-In CmdletsHundreds more from partnersModulesExport-ModuleMemberGet-ModuleImport-ModuleNew-ModuleNew-ModuleManifestRemove-ModuleTest-ModuleManifestEventingGet-EventGet-EventSubscriberNew-EventRegister-EngineEventRegister-ObjectEventRemove-EventUnregister-EventWait-EventWS-ManConnect-WSManDisable-WSManCredSSPDisconnect-WSManEnable-WSManCredSSPGet-WSManCredSSPGet-WSManInstanceInvoke-WSManActionNew-WSManInstanceNew-WSManSessionOptionRemove-WSManInstanceSet-WSManInstanceSet-WSManQuickConfigTest-WSManTransactionsComplete-TransactionGet-TransactionStart-TransactionUndo-TransactionUse-TransactionDebuggingDisable-PSBreakpointEnable-PSBreakpointGet-PSBreakpointGet-PSCallStackRemove-PSBreakpointSet-PSBreakpointType ConversionAdd-TypeConvertFrom-CsvConvertFrom-StringDataConvertTo-CsvConvertTo-XmlDiagnosticsClear-EventLogExport-CounterGet-CounterGet-HotfixGet-WinEventImport-CounterLimit-EventLogNew-EventLogRemove-EventLogShow-EventLogWrite-EventLogComputersAdd-ComputerCheckpoint-ComputerDisable-ComputerRestoreEnable-ComputerRestoreGet-ComputerRestorePointRemove-ComputerReset-ComputerPasswordRestart-ComputerRestore-ComputerStop-ComputerTest-ConnectionWMIInvoke-WMIMethodRegister-WMIEventRemove-WMIObjectSet-WMIInstanceOtherClear-HistoryDebug-ProcessExport-FormatDataGet-FormatDataGet-RandomImport-LocalizedDataOut-GridViewSelect-XmlSend-MailMessageSet-StrictModeStart-ProcessTest-ComputerSecureChannelUpdate-ListWait-ProcessRemotingDisable-PSSessionConfigurationEnable-PSSessionConfigurationEnable-PSRemotingEnter-PSSessionExit-PSSessionExport-PSSessionGet-PSSessionGet-PSSessionConfigurationImport-PSSessionInvoke-CommandNew-PSSessionNew-PSSessionOptionNew-WebServiceProxyRegister-PSSessionConfigurationRemove-PSSessionSet-PSSessionConfigurationCustom SessionsDisable-PSSessionConfigurationEnable-PSSessionConfigurationGet-PSSessionConfigurationNew-PSSessionOptionRegister-PSSessionConfigurationSet-PSSessionConfigurationUnregister-PSSessionConfigurationBackground JobsGet-JobReceive-JobRemove-JobStart-JobStop-JobWait-Job
  • 23.
    16 New Partnersin Windows 7 & WS08 R2Many active internal partnersExchange Server • Windows Diagnostics • Server Manager • SQL Server • Active Directory • Failover Clustering • System Center Operations Manager • Windows Backup • Server Migration • System Center Virtual Machine Manager • Best Practices Analyzer • Active Directory Rights Management Services • Internet Information Services • Background Intelligent Transfer Service • System Center Data Protection Manager • Network Load Balancing • Remote Desktop Services • Group Policy • WS-Management • AppLocker • WMI
  • 24.
    Windows PowerShell CommunityResourcesTeam blog: http://blogs.msdn.com/PowerShellPowerShell Community: http://www.powershellcommunity.orgPowerShell Forum: http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/threadsChannel 9: http://channel9.msdn.com/tags/PowerShellWiki: http://channel9.msdn.com/wiki/default.aspx/Channel9.WindowsPowerShellWikiScript Center: http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspxCodePlex: http://codeplex.com/Project/ProjectDirectory.aspx?TagName=powershellSome good booksPowerShell in Action, 2nd Edition by Bruce Payettehttp://www.manning.com/payette2Windows PowerShell Cookbook, 2nd Edition by Lee Holmes http://oreilly.com/catalog/9780596801519/Professional Windows PowerShell Programming http://www.wrox.com/WileyCDA/WroxTitle/productCd-0470173939.htmlPowerShell Comics! http://borntolearn.mslearn.net/comics/b/weblog/archive/2011/04/20/climbing-mt-powershell-comic-book-first-pages.aspx
  • 25.
    Related ContentBreakout SessionsWSV406| Advanced Automation Using Windows PowerShell 2.0 WSV315 Windows PowerShell for Beginners WCL321 | Windows PowerShell Remoting: Definitely NOT Just for Servers WSV322 | Managing the Registry with Windows PowerShell 2.0WSV471-INT | Build Reusable Tools in Windows PowerShellWSV473-INT | Windows PowerShell 3.0: Why Wait? Get Next-Generation PowerShell…EXL321 | Microsoft Lync Server 2010: Administering Lync Server DeploymentHands-on LabsWSV276-HOL Introduction to Windows PowerShell Fundamentals WSV371-HOL Advanced Windows PowerShell Scripting WSV378-HOL Server Management and Windows PowerShell V2 Product Demo Stations WSV 1 – Windows PowerShell and Server Management
  • 26.
    Track ResourcesDon’t forgetto visit the Cloud Power area within the TLC (Blue Section) to see product demos and speak with experts about the Server & Cloud Platform solutions that help drive your business forward.You can also find the latest information about our products at the following links:Cloud Power - http://www.microsoft.com/cloud/Private Cloud - http://www.microsoft.com/privatecloud/Windows Server - http://www.microsoft.com/windowsserver/Windows Azure - http://www.microsoft.com/windowsazure/Microsoft System Center - http://www.microsoft.com/systemcenter/Microsoft Forefront - http://www.microsoft.com/forefront/
  • 27.
    ResourcesConnect. Share. Discuss.http://northamerica.msteched.comLearningSessionsOn-Demand & CommunityMicrosoft Certification & Training Resourceswww.microsoft.com/techedwww.microsoft.com/learningResources for IT ProfessionalsResources for Developershttp://microsoft.com/technethttp://microsoft.com/msdn
  • 28.
    Complete an evaluationon CommNet and enter to win!
  • 30.
    © 2011 MicrosoftCorporation. 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.