Advanced Automation UsingWindows PowerShell 2.0
WSV406
Jeffrey SnoverDistinguished EngineerMicrosoft
Dan HarmanSenior Program ManagerMicrosoft
Session Overview
Technical Level: 400Intended Audience: IT administrators and scripters
Learning Objectives:Learn about improvements to Windows PowerShell 2.0Understand how to use advanced scripting techniquesSee how PowerShell features work in common scenarios
Presentation 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 features
RemotingPowerShell ISEAdvanced FunctionsBackground JobsRestricted SessionsTransactionsOut-GridViewScript DebuggingNew & Improved CmdletsHosting APIs
ModulesEventingSession PoolsLanguage EnhancementsWMI ImprovementsImproved AD AdapterPerformance ImprovementsScript InternationalizationParser API SupportMore…
PowerShell Architecture
User Experience
Shell
Language
Debugger
Engine
APIs
Execution Context
Object Manager
Managed Elements
Cmdlets
WMI
COM
.NET
XML
ADO
ADSI
Native Commands
PowerShell 2.0 Themes
Production Scripting
Universal Automation Environment
GUI over PowerShell
Language and Cmdlets
GUI Over PowerShell
Layering 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 elements
GUI over PowerShell
GUI Over PowerShell Features
User Experience
Shell
Language
Debugger
Engine
APIs
Execution Context
Object Manager
Managed Elements
Cmdlets
WMI
COM
.NET
XML
ADO
ADSI
Native Commands
Session Pooling
Thread Control
Hosting APIs
PowerShell ISE
Out-GridView
demo
GUI Over PowerShell
Dan HarmanSenior Program ManagerWindows PowerShell
Production Scripting
Scripts are:Easy to useEasy to shareEasy to supportSafe to operate
Production Scripting
Production Scripting Features
User Experience
Shell
Language
Debugger
Engine
APIs
Execution Context
Object Manager
Managed Elements
Cmdlets
WMI
COM
.NET
XML
ADO
ADSI
Native Commands
Advanced Functions
Debugger Enhancements
Restricted Language
Modules
Transactions
Advanced Functions
Native Code
Advanced Functions
Gives 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 capabilities
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
Parameter attributesRangeLengthNot NullNot Null or EmptyPatternSetCountScript
demo
Production ScriptingAdvanced Functions
Jeffrey SnoverDistinguished EngineerWindows PowerShell
demo
Production ScriptingModules
Dan HarmanSenior Program ManagerWindows PowerShell
Universal Automation Environment
Interactive 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 programming
Universal Automation Environment
Automation Environment Features
User Experience
Shell
Language
Debugger
Engine
APIs
Execution Context
Object Manager
Managed Elements
Cmdlets
WMI
COM
.NET
XML
ADO
ADSI
Native Commands
Background Jobs
Restricted Sessions
Mobile Object Model
Eventing
Remoting
Remoting Scenarios
1: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 client
1: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 machine
Many:1 (fan-in): Delegated Administration & HostingHosting model for web servicesNo tools installation required on clientConstrained session environment (cmdlets, parameters, language)
demo
Universal Automation EnvironmentRemoting
Jeffrey SnoverDistinguished EngineerWindows PowerShell
demo
Universal Automation EnvironmentBackground Jobs
Dan HarmanSenior Program ManagerWindows PowerShell
Language and Cmdlets
Responding to community feedbackEnhance the languageImprove the engineProvide more built-in cmdlets
Language and Cmdlets
Language and Cmdlets
User Experience
Shell
Language
Debugger
Engine
APIs
Execution Context
Object Manager
Managed Elements
Cmdlets
WMI
COM
.NET
XML
ADO
ADSI
Native Commands
ImprovedObject Adapters
LanguageEnhancements
New Cmdlets
WMI++
Over 100 New Built-In CmdletsHundreds more from partners
ModulesExport-ModuleMemberGet-ModuleImport-ModuleNew-ModuleNew-ModuleManifestRemove-ModuleTest-ModuleManifest
EventingGet-EventGet-EventSubscriberNew-EventRegister-EngineEventRegister-ObjectEventRemove-EventUnregister-EventWait-Event
WS-ManConnect-WSManDisable-WSManCredSSPDisconnect-WSManEnable-WSManCredSSPGet-WSManCredSSPGet-WSManInstanceInvoke-WSManActionNew-WSManInstanceNew-WSManSessionOptionRemove-WSManInstanceSet-WSManInstanceSet-WSManQuickConfigTest-WSMan
TransactionsComplete-TransactionGet-TransactionStart-TransactionUndo-TransactionUse-Transaction
DebuggingDisable-PSBreakpointEnable-PSBreakpointGet-PSBreakpointGet-PSCallStackRemove-PSBreakpointSet-PSBreakpoint
Type ConversionAdd-TypeConvertFrom-CsvConvertFrom-StringDataConvertTo-CsvConvertTo-Xml
DiagnosticsClear-EventLogExport-CounterGet-CounterGet-HotfixGet-WinEventImport-CounterLimit-EventLogNew-EventLogRemove-EventLogShow-EventLogWrite-EventLog
ComputersAdd-ComputerCheckpoint-ComputerDisable-ComputerRestoreEnable-ComputerRestoreGet-ComputerRestorePointRemove-ComputerReset-ComputerPasswordRestart-ComputerRestore-ComputerStop-ComputerTest-Connection
WMIInvoke-WMIMethodRegister-WMIEventRemove-WMIObjectSet-WMIInstance
OtherClear-HistoryDebug-ProcessExport-FormatDataGet-FormatDataGet-RandomImport-LocalizedDataOut-GridViewSelect-XmlSend-MailMessageSet-StrictModeStart-ProcessTest-ComputerSecureChannelUpdate-ListWait-Process
RemotingDisable-PSSessionConfigurationEnable-PSSessionConfigurationEnable-PSRemotingEnter-PSSessionExit-PSSessionExport-PSSessionGet-PSSessionGet-PSSessionConfigurationImport-PSSessionInvoke-CommandNew-PSSessionNew-PSSessionOptionNew-WebServiceProxyRegister-PSSessionConfigurationRemove-PSSessionSet-PSSessionConfiguration
Custom SessionsDisable-PSSessionConfigurationEnable-PSSessionConfigurationGet-PSSessionConfigurationNew-PSSessionOptionRegister-PSSessionConfigurationSet-PSSessionConfigurationUnregister-PSSessionConfiguration
Background JobsGet-JobReceive-JobRemove-JobStart-JobStop-JobWait-Job
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/PowerShellPowerShell Community: http://www.powershellcommunity.orgPowerShell Forum: http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/threads Channel 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 books
PowerShell in Action, 2nd Edition by Bruce Payettehttp://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 ContentBreakout 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.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 Deployment
Hands-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 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:
Windows Azure - http://www.microsoft.com/windowsazure/
Microsoft System Center - http://www.microsoft.com/systemcenter/
Microsoft Forefront - http://www.microsoft.com/forefront/
Windows Server - http://www.microsoft.com/windowsserver/
Cloud Power - http://www.microsoft.com/cloud/
Private Cloud - http://www.microsoft.com/privatecloud/
Resources
www.microsoft.com/teched
Sessions On-Demand & Community Microsoft Certification & Training Resources
Resources for IT Professionals Resources for Developers
www.microsoft.com/learning
http://microsoft.com/technet http://microsoft.com/msdn
Learning
http://northamerica.msteched.com
Connect. Share. Discuss.
Complete an evaluation on CommNet and enter to win!
Scan the Tag to evaluate this session now on myTech•Ed Mobile
© 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.