310 likes | 694 Views
WSV406. Advanced Automation Using Windows PowerShell 2.0. Jeffrey Snover Distinguished Engineer Microsoft. Dan Harman Senior Program Manager Microsoft. Session Overview. Technical Level: 400 Intended Audience: IT administrators and scripters Learning Objectives:
E N D
WSV406 Advanced Automation UsingWindows PowerShell 2.0 Jeffrey Snover Distinguished Engineer Microsoft Dan Harman Senior Program Manager Microsoft
Session Overview • Technical Level: 400 • Intended Audience: IT administrators and scripters • Learning Objectives: • Learn about improvements to Windows PowerShell 2.0 • Understand how to use advanced scripting techniques • See how PowerShell features work in common scenarios • Presentation Outline: • Overview of new PowerShell 2.0 features • Advanced scripting techniques in depth • GUI over PowerShell demo • Production scripting demo • Universal automation environment demo
Improvements in PowerShell 2.0Dozens of big features • Remoting • PowerShell ISE • Advanced Functions • Background Jobs • Restricted Sessions • Transactions • Out-GridView • Script Debugging • New & Improved Cmdlets • Hosting APIs • Modules • Eventing • Session Pools • Language Enhancements • WMI Improvements • Improved AD Adapter • Performance Improvements • Script Internationalization • Parser API Support • More…
PowerShell 2.0 Themes Production Scripting Universal Automation Environment GUI over PowerShell Language and Cmdlets
GUI Over PowerShell • Layering admin GUIs on top of PowerShell • Drives consistency between CLI & GUI • Enables agility in delivering new GUIs • Guarantees automation of GUI commands • Facilitates GUI teaching command line • Standardizes access to managed elements GUI over PowerShell
GUI Over PowerShell Features PowerShell ISE Out-GridView Hosting APIs Session Pooling Thread Control
GUI Over PowerShell Dan Harman Senior Program Manager Windows PowerShell demo
Production Scripting Production Scripting • Scripts are: • Easy to use • Easy to share • Easy to support • Safe to operate
Production Scripting Features Advanced Functions Advanced Functions Native Code Debugger Enhancements Restricted Language Modules Transactions
Advanced Functions • Gives the power of authoring custom cmdlets to IT pros • Write PowerShell cmdlets using script instead of compiled code • Enables consistent syntax and semantics between functions & cmdlets • Evolution of function syntax from PowerShell 1.0 • Near parity with .NET cmdlet capabilities • Parameter attributes • Range • Length • Not Null • Not Null or Empty • Pattern • Set • Count • Script • Cmdlet 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
Production ScriptingAdvanced Functions Jeffrey Snover Distinguished Engineer Windows PowerShell demo
Production ScriptingModules Dan Harman Senior Program Manager Windows PowerShell demo
Universal Automation Environment • Interactive or programmatic • In the foreground or background • Local or remote • Single machine or multiple machines • Synchronous or asynchronous • In restricted or unrestricted environments • Wide range of authentication mechanisms • Simple scripting to systems programming Universal Automation Environment
Automation Environment Features Remoting Background Jobs Eventing Restricted Sessions Mobile Object Model
Remoting Scenarios • 1:Many (fan-out): Large Scale Automation • Send the script to remote machines • Select properties - allows client to specify which properties to return • Throttling - limits the number of concurrent operations • Job support - runs commands in the background on client • 1:1 (interactive): Secure Telnet Replacement • Cmdlet equivalent of Remote Desktop • Interact with a remote machine as if it were local • No Invoke-Command required • Ideal for troubleshooting a remote machine • Many:1 (fan-in): Delegated Administration & Hosting • Hosting model for web services • No tools installation required on client • Constrained session environment (cmdlets, parameters, language)
Universal Automation EnvironmentRemoting Jeffrey Snover Distinguished Engineer Windows PowerShell demo
Universal Automation EnvironmentBackground Jobs Dan Harman Senior Program Manager Windows PowerShell demo
Language and Cmdlets • Responding to community feedback • Enhance the language • Improve the engine • Provide more built-in cmdlets Language and Cmdlets
Language and Cmdlets New Cmdlets WMI++ Language Enhancements Improved Object Adapters
Over 100 New Built-In CmdletsHundreds more from partners Remoting • Disable-PSSessionConfiguration • Enable-PSSessionConfiguration • Enable-PSRemoting • Enter-PSSession • Exit-PSSession • Export-PSSession • Get-PSSession • Get-PSSessionConfiguration • Import-PSSession • Invoke-Command • New-PSSession • New-PSSessionOption • New-WebServiceProxy • Register-PSSessionConfiguration • Remove-PSSession • Set-PSSessionConfiguration Custom Sessions • Disable-PSSessionConfiguration • Enable-PSSessionConfiguration • Get-PSSessionConfiguration • New-PSSessionOption • Register-PSSessionConfiguration • Set-PSSessionConfiguration • Unregister-PSSessionConfiguration Background Jobs • Get-Job • Receive-Job • Remove-Job • Start-Job • Stop-Job • Wait-Job Modules • Export-ModuleMember • Get-Module • Import-Module • New-Module • New-ModuleManifest • Remove-Module • Test-ModuleManifest Eventing • Get-Event • Get-EventSubscriber • New-Event • Register-EngineEvent • Register-ObjectEvent • Remove-Event • Unregister-Event • Wait-Event WS-Man • Connect-WSMan • Disable-WSManCredSSP • Disconnect-WSMan • Enable-WSManCredSSP • Get-WSManCredSSP • Get-WSManInstance • Invoke-WSManAction • New-WSManInstance • New-WSManSessionOption • Remove-WSManInstance • Set-WSManInstance • Set-WSManQuickConfig • Test-WSMan Transactions • Complete-Transaction • Get-Transaction • Start-Transaction • Undo-Transaction • Use-Transaction Debugging • Disable-PSBreakpoint • Enable-PSBreakpoint • Get-PSBreakpoint • Get-PSCallStack • Remove-PSBreakpoint • Set-PSBreakpoint Type Conversion • Add-Type • ConvertFrom-Csv • ConvertFrom-StringData • ConvertTo-Csv • ConvertTo-Xml Diagnostics • Clear-EventLog • Export-Counter • Get-Counter • Get-Hotfix • Get-WinEvent • Import-Counter • Limit-EventLog • New-EventLog • Remove-EventLog • Show-EventLog • Write-EventLog Computers • Add-Computer • Checkpoint-Computer • Disable-ComputerRestore • Enable-ComputerRestore • Get-ComputerRestorePoint • Remove-Computer • Reset-ComputerPassword • Restart-Computer • Restore-Computer • Stop-Computer • Test-Connection WMI • Invoke-WMIMethod • Register-WMIEvent • Remove-WMIObject • Set-WMIInstance Other • Clear-History • Debug-Process • Export-FormatData • Get-FormatData • Get-Random • Import-LocalizedData • Out-GridView • Select-Xml • Send-MailMessage • Set-StrictMode • Start-Process • Test-ComputerSecureChannel • Update-List • Wait-Process
16 New Partners in Windows 7 & WS08 R2Many active internal partners Exchange 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 Resources • Team blog: http://blogs.msdn.com/PowerShell • PowerShell Community: http://www.powershellcommunity.org • PowerShell Forum: http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/threads • Channel 9: http://channel9.msdn.com/tags/PowerShell • Wiki: http://channel9.msdn.com/wiki/default.aspx/Channel9.WindowsPowerShellWiki • Script Center: http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx • CodePlex: http://codeplex.com/Project/ProjectDirectory.aspx?TagName=powershell • Some good books • PowerShell in Action, 2nd Edition by Bruce Payette http://www.manning.com/payette2 • Windows PowerShell Cookbook, 2nd Edition by Lee Holmes http://oreilly.com/catalog/9780596801519/ • Professional Windows PowerShell Programming http://www.wrox.com/WileyCDA/WroxTitle/productCd-0470173939.html • PowerShell Comics! http://borntolearn.mslearn.net/comics/b/weblog/archive/2011/04/20/climbing-mt-powershell-comic-book-first-pages.aspx
Related Content • Breakout Sessions • WSV406 | 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.0 • WSV471-INT | Build Reusable Tools in Windows PowerShell • WSV473-INT | Windows PowerShell 3.0: Why Wait? Get Next-Generation PowerShell… • EXL321 | Microsoft Lync Server 2010: Administering Lync Server Deployment • Hands-on Labs • WSV276-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 Resources Don’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/
Resources • Connect. Share. Discuss. http://northamerica.msteched.com Learning • Sessions On-Demand & Community • Microsoft Certification & Training Resources www.microsoft.com/teched www.microsoft.com/learning • Resources for IT Professionals • Resources for Developers http://microsoft.com/technet http://microsoft.com/msdn
© 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.