530 likes | 753 Views
WSV414. Advanced Automation Using Windows PowerShell 3.0 WSV414. Mir Rosenberg Senior Program Manager Microsoft Corporation. Dan Harman Senior Program Manager Microsoft Corporation. Session Overview. Technical Level: 400 Intended Audience: IT administrators & scripters
E N D
WSV414 Advanced Automation Using Windows PowerShell 3.0WSV414 Mir Rosenberg Senior Program Manager Microsoft Corporation Dan Harman Senior Program Manager Microsoft Corporation
Session Overview • Technical Level: 400 • Intended Audience: IT administrators & scripters • Learning Objectives: • Learn about the improvements in Windows PowerShell 3.0 • Understand how to use advanced automation techniques • See how PowerShell features work in common scenarios
Windows Server Management Philosophy In the past, Windows Server was a great operating system • for a singleserver • and its devices Windows Server 2012 is a great operating system • for manyservers • and the devices that connectthem • whether they are physicalor virtual • onpremises or offpremises
Managing a Cloud-Optimized OS • Automate • Remote • Agile • PowerShell • Standards • Scale • Robust
Windows PowerShell 3.0 Themes Simple & Easy Comprehensive Coverage Robust & Scalable Rich Platform Standards-based v3.0 -gt v2.0
Windows PowerShell 3.0 Features DEMO DEMO: Default Param Values DEMO DEMO: Disconnected Sessions DEMO DEMO: Module Autoloading DEMO DEMO: Member Enumeration DEMO: PowerShell Workflow DEMO DEMO DEMO: OData Endpoints DEMO: RunAs Support DEMO DEMO: Web Cmdlets DEMO DEMO: PS Web Access DEMO Updatable help system Method overload discovery HelpUri attribute support HelpFile property on FunctionInfo Simplified Where and ForEach Remoting local variables via $using Dynamic types & formats Get-Content -Tail Generic method invocation Typecasting deserialized objects New parser built on DLR Improved method overload selection New objects from hash tables Typecasting for parameter values Pipeline paging APIs Nested pipeline APIs $PSScriptRoot and $PSCommandPath Ordered hash tables Improved module discovery & import New module manifest keys Public abstract syntax tree Runspace pool cleanup API Public tab completion Windows RT API support Obsolete cmdlet attribute Command discovery improvements Script autosave support Out-GrideView -PassThru CIM cmdlet authoring from WMI v2 CIM .NET APIs Scheduled jobs Runtime script compilation Engine reliability improvements Better Get-ChildItem network perf Cmdlet definition files Certificate provider improvements Alternate NTFS data stream support Move-Item across drives Remote module discovery & import Remote session autodisconnect & retry Credentials for FileSystem provider Transport options for remote sessions Module logging Workflow persistence Job integration with Task Scheduler Alternate credential support for jobs Updated console font & branding Verb & noun on FunctionInfo Special character handling LiteralPath support for core cmdlets DLR-based tab completion Session configuration files IntelliSense support Windows Management Framework 3.0 WinPE support Windows RT support Windows PowerShell Web Access XAML-based workflows Script-based workflows Control Panel cmdlets Unblock-File cmdlet Workflow help Cmdlet to activity conversion RunAs and SharedHost support Improved WMI object formatting Heterogeneous object formatting Workflow logging Workflow extensibility Common workflow parameters Workflow execution environment Management OData IIS Extension Snippets ISE Add-ons $PSItem alias for $_ Show-Command Get-Help -ShowWindow Restart Manager support Web & REST cmdlets JSON cmdlets XML syntax highlighting Block select Collapsible regions Contextual F1 support Script Explorer DEMO DEMO DEMO DEMO: Session Config Files DEMO: Scheduled Jobs DEMO: File System Creds Windows PowerShell Workflow .NET Framework 4 support Add-Member improvements Computer cmdlets CSV handling improvements Get-ChildItem attributes Get-Command improvements Default Parameter Values Better history support Security cmdlet fixes Select-Object optimizations Select-String improvements Tee-Object -Append Disconnected sessions Idle timeout & server buffering control Invoke-Command in disconnected sessions Disconnected jobs STA mode by default Run with PowerShell context menu Module autoloading Console host start perf improvements ETW logging and tracing Core CIM cmdlets New Group Policy settings Output redirection for all streams Array member enumeration Word wrap in console host Default properties on custom objects DEMO DEMO: Ordered Hashtables DEMO DEMO: Method Overloads DEMO DEMO DEMO: Command Discovery DEMO: Parser Performance
Windows PowerShell 3.0 Themes Simple & Easy Comprehensive Coverage Robust & Scalable Rich Platform Standards-based v3.0 -gt v2.0
Simple & Easy for Existing Users • Ordered hash tables • New objects fromhash tables • Add-Member improvements • Default properties oncustom objects • Dynamic types & formats • Typecasting deserialized objects • Typecasting parameter values • Heterogeneous object formatting • Custom parametervalue defaults • Select-String improvements • Special character handling • LiteralPath support forcore cmdlets • XML syntax highlighting • Command + output insingle pane • Out-GridView-PassThru • Restart Manager support ETS Types & Formats Cmdlets ISE
demo Simplified Language Simple & Easy Dan Harman Senior Program Manager Windows PowerShell Mir Rosenberg Senior Program Manager Windows PowerShell
Simple & Easy Delegated Administration • Session Configuration Files • Easy remote endpoint creation • Uses PowerShell data files • Declarative name-value pairs • No scripting required • RunAs • New settings within WSMan plug-in • RunAsUser & RunAsPassword • Allows running remote sessions with different creds • SharedHost • Normally each session runs in a separate process • Allows multiple remote sessions to run in same process
demo Delegated Administration Simple & Easy Dan Harman Senior Program Manager Windows PowerShell
Windows PowerShell 3.0 Themes Simple & Easy Comprehensive Coverage Robust & Scalable Rich Platform Standards-based v3.0 -gt v2.0
Management CEC • CEC: Common Engineering Criteria • What: All Microsoft server products are required to comply with a set of engineering requirements as part of the CEC • Goal: Reduce the total cost of ownership through improved integration, manageability, security, reliability, and other critical infrastructure • Requirement: All management surfaces must be exposed via PowerShell cmdlets or providers • Result:COVERAGE
Coverage Comparison • Windows Server 2008 R2 shipped with 587 cmdlets • Q: How many cmdlets shipped in Windows Server 2012 RC? • 651 • 728 • 904 • 2321 • Windows Server 2008 R2 shipped with 12 modules • Q: How many modules shipped in Windows Server 2012 RC? • 24 • 30 • 85 • 99
demo Coverage Coverage Mir Rosenberg Senior Program Manager Windows PowerShell
New Cmdlets in Windows PowerShell 3.0Thousands more in Windows Server 2012 Jobs • Add-JobTrigger • Disable-JobTrigger • Enable-JobTrigger • Get-JobTrigger • New-JobTrigger • Remove-JobTrigger • Set-JobTrigger • Disable-ScheduledJob • Enable-ScheduledJob • Get-ScheduledJob • Register-ScheduledJob • Set-ScheduledJob • Unregister-ScheduledJob • Get-ScheduledJobOption • New-ScheduledJobOption • Set-ScheduledJobOption ISE • Get-IseSnippet • Import-IseSnippet • New-IseSnippet CIM • Get-CimAssociatedInstance • Get-CimClass • Get-CimInstance • Get-CimSession • Invoke-CimMethod • New-CimInstance • New-CimSession • New-CimSessionOption • Register-CimIndicationEvent • Remove-CimInstance • Remove-CimSession • Set-CimInstance Remoting • Connect-PSSession • Disconnect-PSSession • Receive-PSSession • New-PSSessionConfigurationFile • Test-PSSessionConfigurationFile • New-PSTransportOption Workflow • New-PSWorkflowSession • New-PSWorkflowExecutionOption • Invoke-AsWorkflow • Resume-Job • Suspend-Job Web • ConvertFrom-Json • ConvertTo-Json • Invoke-RestMethod • Invoke-WebRequest Other • New-WinEvent • Unblock-File • Show-Command • Rename-Computer • Save-Help • Update-Help • Get-TypeData • Remove-TypeData • Get-ControlPanelItem • Show-ControlPanelItem
Available Everywhere • Windows 8, Windows RT, & Windows Server 2012 Full Server • PowerShell Remoting enabled by default on Server SKUs • Server Core • With or without Server Graphical Shell or Graphical Management Tools • CIM modules remotable without PowerShell or .NET Framework installed • Windows Preinstallation Environment (WinPE) 4.0 • Windows Management Framework 3.0 • Windows Server 2008 / Windows 7 / Windows Server 2008 R2 (+Server Core) • Windows PowerShell Web Access • Access to PowerShell via web browser interface • Cross-platform support (IE, Firefox, Safari, Chrome)
Windows PowerShell 3.0 Themes Simple & Easy Comprehensive Coverage Robust & Scalable Rich Platform Standards-based v3.0 -gt v2.0
Windows PowerShell Workflow • WHAT: Multi-machine orchestration engine built on Windows Workflow Foundation and .NET 4.0 • WHY: Reliably execute long-running management tasks across multiple machines or IT processes • HOW: • Robust: Suspend & resume workflows, survive machine interruptions • Scalable: Parallel task execution, common multi-machine parameters • Reliable: Automatic connection and action retry with configurable intervals • Performance: Connection pooling, workflow throttling, shared hosting • Familiar: Author workflows as PS scripts or XAML, manage via *-Job cmdlets
Workflow Demo Setup SAME SAME • Management Server • Runs PowerShell Workflow • Accepts incoming connections from admin clients • Targets workflows at multiple managed nodes • Managed Nodes • Machines targeted by workflows • Admin Client • Where IT pro does their work • Connects to Management Server
demo PowerShell Workflow Robust & Scalable Mir Rosenberg Senior Program Manager Windows PowerShell
Scheduled Jobs • Job Scheduling allows you to schedule the execution of a PowerShell background job • Support for a rich set of triggers • Daily, weekly, or custom interval (day, week, month) • Once or with a specific repetition duration or interval • In response to a specific event such as log on or startup • Run under a different user account • PSScheduledJob module with 16 cmdlets • *-JobTrigger to create scheduled triggers • *-ScheduledJob to register, unregister, and change job definitions • *-ScheduledJobOption to configure advanced settings • *-Job to retrieve results any job type
demo Scheduled Jobs Robust & Scalable Dan Harman Senior Program Manager Windows PowerShell
Robust Session Connectivity • Remote sessions remain in a "Connected" state during transient network glitches or failures for up to 4 minutes • After 4 minutes, remote sessions automatically transition to a new "Disconnected" state • Persistent commands and jobs can continue to run even if the session is disconnected • Client can reconnect to a disconnected session after network connectivity with the server has been restored • Cmdlets for managing disconnected sessions
demo Disconnected Sessions Robust & Scalable Dan Harman Senior Program Manager Windows PowerShell
Windows PowerShell 3.0 Themes Simple & Easy Comprehensive Coverage Robust & Scalable Standards-based v3.0 -gt v2.0 Rich Platform
Windows PowerShell Web Access • Provides access to Windows PowerShell from anywhere • Increases the value of your investment in PowerShell • Write cmdlets, get web-based management for free • Built for tablets and mobile devices as well as PCs • Cross-platform support: IE, Firefox, Safari, Chrome Internet Access Corporate network Windows PowerShell Web Access Client
demo PowerShell Web Access Rich Platform Mir Rosenberg Senior Program Manager Windows PowerShell
Windows PowerShell ISEIntegrated Scripting Environment • IntelliSense • Tab Completion API • Show-Command Pane • Module Autoloading • Regions & Outlining • Abstract Syntax Tree • F1 Help Window • Updatable Help System • Syntax Highlighting & Rich Copy • Abstract Syntax Tree IntelliSense
Rich Platform Enables Script Sharing • TechNet Script Center • Script Repository • Script Explorer • ISE Add-ons Website • PowerShell Modules • PoshCode.org • PowerShellCommunity.org • PowerShell.com • PowerShellGroup.org • Windows PowerShell ISVs
Windows PowerShell 3.0 Themes Simple & Easy Comprehensive Coverage Robust & Scalable Rich Platform v3.0 -gt v2.0 Standards-based
Standards-based Management • Provides management interoperability with standard interfaces and protocols • DMTF standards • Interface => Common Information Model (CIM) • Defines a consistent way to manage everything in the datacenter • WMI v2: Access to CIM over WSMan • PowerShell cmdlets automatically generated from WMI v2 providers • Protocol => Web Services for Management (WSMan) • Provides web services access to CIM on heterogeneous devices • WinRM: Microsoft implementation of the WSMan protocol • Microsoft extensions to WSMan enable PowerShell remoting
Learn More WSV308 Standards Support and Interoperability in Windows Server 2012: Storage, Networking, and Management Speakers: Gene Chellis, WojtekKozaczynski, Jeffrey Snover, and SharadKylasam Wednesday, June 27 at 2:45p - 4:00p in Hall 3A Windows Server | Breakout Session | 300 - Advanced
Management OData IIS Extension • Open Data Protocol (OData): RESTful web protocol based on HTTP and JSON for querying and updating data • Management OData IIS Extension: Infrastructure to create web service endpoints for remote management via OData • Enables management of Windows Server from heterogeneous clients: Windows, non-Windows, mobile, JavaScript, PHP, Perl, .NET, etc. • Accepts incoming OData requests, maps requests to PowerShell cmdlets, invokes the cmdlets, and returns output to the client • Ships with WS2012 and WMF 3.0, samples in Windows SDK • Schema Designer:Graphical tool to create authorization DLLs and schema files needed to deploy a Management OData endpoint
Management OData Demo Setup SAME SAME • Management Server • Runs Management OData IIS Extension • Managed Nodes • Machines targeted by management operations • Admin Client • Where IT pro does their work • Connects to Management Server
demo Management OData IIS Extension Standards-based Mir Rosenberg Senior Program Manager Windows PowerShell
Windows PowerShell 3.0 Themes Simple & Easy Comprehensive Coverage Robust & Scalable Rich Platform Standards-based v3.0 -gt v2.0
New & Improved in Windows PowerShell 3.0 • PowerShell Workflow • Windows PowerShell Web Access • ISE enhancements • WinPE and Windows RT support • Disconnected sessions • Robust session connectivity • Updatable help system • CIM cmdlets • Session configuration files • Scheduled jobs • Language enhancements • New core cmdlets • Remote module import and discovery • New tab completion with IntelliSense • Module experience improvements • Simplified command discovery • Better logging and diagnostics • Improved core cmdlets and providers • Format and output improvements • Enhanced console host experience • New cmdlet and hosting APIs • Performance improvements • RunAs and Shared Host support • Special character handling Products of true enduring quality are not those that do 1 thing 1,000% better but those that do 1,000s of things 1% better
Top Votes on ConnectOver 250 feedback items addressed • Capture Warning, Verbose, Debug and Host Output via alternate streams • Add enumeration parameter to Get-ChildItem cmdlet to specify Container/Non-container/Both • dir -ad and other Get-ChildItem improvements • Make it easier to create custom objects • Ordered hashes as an option • Modules: Unable to determine script module filename at load time (there should be a $psmoduleinfo) • Get-Command and Get-Help should display the ModuleName • MVP: Get-Module output should sort by name by default • PSV2: Lazy pipeline - ability for cmdlets to say "NO MORE" • Add auto-variable $PSScriptRoot • Script Logging needs to be improved • Import-Csv should have -Encoding parameter • add an -Append Switch to Export-CSV • Tee-Object Needs -Append parameter • Add "sst" alias for Select-String cmdlet • Bug with Default Formatter • *-item cmdlets ignore items containing "[]" • Square Bracket "Range" globbing is a bug not a feature • Can’t redirect all the output pipelines • Get-ACL (and some other cmdlets) need support for the LiteralPath parameter • Get-Command doesn't show function if 2 modules are loaded that have same function name • Get-Command doesn't display information about duplicate commands • Foreach should not execute the loop body for a scalar value of $null • Default properties on custom objects • Select-Object optimization • Set-AuthenticodeSignature fails on scripts created from ISE • Multiple ambiguous overloads • Move-Item cmdlet can’t move items between different PSDrives • Same command with different output fails if run in sequence
demo v3.0 -gt v2.0 v3.0 -gt v2.0 foreach–parallel ($SeniorProgramManagerin "Dan Harman","Mir Rosenberg") { Start-DemoPowerShell-Version3.0 }
Get-Involved ^ ^ | | ― turbocommand
Call to Action • Windows PowerShell 3.0 provides a comprehensive, resilient, and simple way to automate the management of servers in your network • Pick up the RC bits today • Windows 8 Release Preview and Windows Server 2012 RC • Windows Management Framework 3.0 RC • http://www.microsoft.com/downloads and search for "WMF 3 RC" Join-In | Send-Feedback | Invoke-Fun
Related Content • Breakout Sessions • WSV306: Inside Windows Server 2012 Multi-server Management Capabilities • WSV335: Using the Windows Server 2012 Server Manager for Remote and Multi-Server Management • WSV308: Standards Support and Interoperability in Windows Server 2012: Storage, Networking, and Management • WSV321: Windows PowerShell for Beginners • WSV414: Advanced Automation Using Windows PowerShell 3.0 • WSV02-LNC: Windows Server 2012 Deployment & Management • FDN04: Modernize Your Datacenter • WSV01-LNC: Q&A with Jeffrey Snover • AZR321: Building, Running, and Managing Workflows on Windows Azure • WSV301: Building Hosted Public and Private Clouds Using Windows Server 2012 • Hands-on Labs • WSV25-HOL: Multi-Server Management with Windows Server 2012 Server Manager and PowerShell 3.0 • WSV12-HOL: Introduction to Windows PowerShell Fundamentals 3.0 • WSV11-HOL: What's New in Windows PowerShell 3.0 • Product Demo Stations • Windows Server 2012 Server Manager & PowerShell • Windows Server 2012 Active Directory, Group Policy and DAC
SIA, WSV, and VIR Track Resources Talk to our Experts at the TLC #TEWSV414 Hands-On Labs DOWNLOAD Windows Server 2012 Release Candidate microsoft.com/windowsserver DOWNLOAD Microsoft System Center 2012 Evaluation microsoft.com/systemcenter
Resources Learning TechNet • Connect. Share. Discuss. • Microsoft Certification & Training Resources http://europe.msteched.com www.microsoft.com/learning • Resources for IT Professionals • Resources for Developers • http://microsoft.com/technet http://microsoft.com/msdn
Evaluations Submit your evals online http://europe.msteched.com/sessions
Windows PowerShell Web Access Security Client Certificate Authentication Forms-based Gateway Authentication WPWA Authorization Rules Target Authorization & Authorization Rules Target Defense In Depth