$$ idea updatable help system method overload discovery helpuri attribute support helpfile property...
TRANSCRIPT
Hosting Day Workshop
ORK Introduction
Gang PanMicrosoft
Session Overview• Welcome• Series of workshops, demos and examples• Define or re-cap Business Objectives• Determine which workshops are needed
Scale is “great and terrible”
Rapid changes is “great and terrible”
What everyone wants …Continuous service availability +Continuous rapid release cycle +Continuous deployment_________
Automation
$$IdeaBusiness Development Operations
In the past, Windows Server was a great operating system
• for a single server• and its devices
Windows Server 2012 is a great operating system• for many servers• and the devices that connect them• whether they are physical or virtual• on premises or off premises
Windows Server Management Philosophy
PowerShell Automation is…
• We know…• Admins are busy and don’t have time• Learning a new language and system (aka PowerShell) takes time!
• We vow… • Learn PowerShell and we will make it the best investment you ever
made• We will leverage what you learn over and over and over
PowerShell “Sacred Vow”
• PowerShell 1.0• Introduced a great scripting language for local machine management• Great APIs for developers to write cmdlets and providers• Microsoft Exchange made a big bet on PowerShell• Shipped with Windows Server 2008
• PowerShell 2.0• Shipped with Windows 7 and Windows Server 2008 R2• Remoting introduced: 1:1, Fan-out, Fan-in, Implicit remoting• Introduced ISE: Syntax coloring, Graphical debugging, Intl. support• Introduced Modules: Self containing packaging mechanism• IT Pros can create PowerShell cmdlets using PowerShell script• Huge feature set: • Background Jobs, Restricted Sessions, Transactions, Out-GridView, Eventing
The Journey
Windows PowerShell 3.0 Features Windows PowerShell Workflow.NET Framework 4 supportAdd-Member improvementsComputer cmdletsCSV handling improvementsGet-ChildItem attributesGet-Command improvementsGet-Content -TailBetter history supportSecurity cmdlet fixesSelect-Object optimizationsSelect-String improvementsTee-Object -AppendDisconnected sessionsIdle timeout & server buffering controlInvoke-Command in disconnected sessionsDisconnected jobsSTA mode by defaultRun with PowerShell context menuUpdated console font & brandingConsole host start perf improvementsETW logging and tracingScheduled jobsNew Group Policy settingsOutput redirection for all streamsDynamic types & formatsWord wrapDefault properties on custom objects
Updatable help systemMethod overload discoveryHelpUri attribute supportHelpFile property on FunctionInfoSimplified Where and ForEachRemoting local variables via $usingArray syntax for scalarsNew parser built on DLRCustom parameter value defaultsGeneric method invocationTypecasting deserialized objectsImproved method overload selectionNew objects from hash tablesOrdered hash tablesTypecasting for parameter valuesPipeline paging APIsNested pipeline APIs$PSScriptRoot and $PSCommandPathImproved module discovery & importNew module manifest keysPublic abstract syntax treeRunspace pool cleanup APIPublic tab completionWindows RT API supportObsolete cmdlet attributeVerb & noun on FunctionInfoWeb & REST cmdletsJSON cmdlets
CIM cmdlet authoring from WMI v2CIM .NET APIsCore CIM cmdletsRuntime script compilationEngine reliability improvementsBetter Get-ChildItem network perfCmdlet definition filesCertificate provider improvementsCredentials for FileSystem providerAlternate NTFS data stream supportMove-Item across drivesRemote module discovery & importRemote session autodisconnect & retryTransport options for remote sessionsModule loggingRunAs and SharedHost supportJob integration with Task SchedulerAlternate credential support for jobsModule autoloadingCommand discovery improvementsSpecial character handlingLiteralPath support for core cmdletsImproved tab completionSession configuration filesIntellisenseWindows Management Framework 3.0WinPE supportWindows RT support
Windows PowerShell Web AccessXAML-based workflowsScript-based workflowsControl Panel cmdletsUnblock-File cmdletWorkflow helpCmdlet to activity conversionWorkflow persistenceImproved WMI object formattingHeterogeneous object formattingWorkflow loggingWorkflow extensibilityCommon workflow parametersWorkflow execution environmentWindows PowerShell Web ServicesSnippetsISE Add-onsIntelliSense supportShow-CommandGet-Help -ShowWindowRestart Manager supportScript autosave supportOut-GridView -PassThruXML syntax highlightingBlock selectCollapsible regionsContextual F1 supportScript Explorer
PowerShell Workflow
Scheduled Jobs
Array Syntax
Enhanced ISE
Delegated Admin
Remoting
CEC / CIM Results
Windows PowerShell 3.0 Themes
Simple & Easy v3.0 -gt v2.0
Robust & Scalable
Comprehensive Coverage
Standards-based
• 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 overall 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
Management CEC
Rough Coverage Comparison
Windows Server 2012Core cmdlets: 305Total cmdlets: 2300Modules: 239
Windows Server 2008 R2Core cmdlets: 249
Total cmdlets: 456
Modules: 10
CIM Based CmdletsLeverage WMI Investment
Write a WMI v2 provider
Write a Cmdlet Definition File (.cdxml)
Get PowerShell cmdlets with a low cost of entry
BenefitsNo dependency on .NET FrameworkIdeal for low level components (file system, networking)Remoting over CIM using WSMan and CimSessions
<?xml version="1.0" encoding="utf-8"?>
<PowerShellMetadata xmlns="http://schemas.microsoft.com/cmdlets-over-objects/2009/11">
<Class ClassName="ROOT/StandardCimv2/MSFT_NetAdapter" ClassVersion="1.0.0">
<Version>1.0</Version>
<DefaultNoun>NetAdapter</DefaultNoun>
<InstanceCmdlets>
<GetCmdletParameters DefaultCmdletParameterSet="ByName">
<QueryableProperties>
<Property PropertyName="Name">
<Type PSType ="string"/>
<RegularQuery AllowGlobbing="true">
<CmdletParameterMetadata PSName="Name" Position="0" CmdletParameterSets="ByName" />
</RegularQuery>
</Property>
...
New Cmdlets in Windows PowerShell 3.0Thousands more in Windows Server 2012Jobs• 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-PSWorkflowExecutionOption• New-PSWorkflowSession• 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• Non-Windows Platforms Via NanoWEBM / OMI• 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, Opera, Chrome)
Windows PowerShell ISEIntegrated Scripting Environment
• IntelliSense• Snippets• Add-on Tools• Show-Command pane• Regions• F1 Help window• Rich copy & block select• Single pane I/O• AutoSave support• XML syntax highlighting• Debugger enhancements• Recent items list
IntelliSense
Simple & Easy for New Users
Windows PowerShell ISE• IntelliSense• Tab completion• Editor
enhancements• Autosave support• Snippets
Command Discovery• Get-Command
discovery cache• Automatic module
importing• Show-Command• Run with
PowerShell
Help System Improvements• Updatable help• Contextual F1• Get-Help ˗ShowWindow
• Word wrap in help output
Syntax & Language• Simplified Where
& ForEach• $PSItem alias for
$_• Array syntax for
singletons• Get-ChildItem
Simple & Easy for Existing Users
ETS
Ordered hash tablesNew objects fromhash tablesAdd-Member improvementsDefault properties oncustom objects
Types & Formats
Dynamic types & formatsTypecasting deserialized objectsTypecasting parameter valuesHeterogeneous object formatting
Cmdlets
Custom parametervalue defaultsSelect-String improvementsSpecial character handlingLiteralPath support forcore cmdlets
ISE
XML syntax highlightingCommand + output insingle paneOut-GridView -PassThruRestart Manager support
PowerShell WorkflowMulti-machine orchestration engine built on Windows Workflow Foundation and .NET 4.0• Launch-able from command-line or SC Orchestrator• Reliably execute long-running management tasks
across multiple machines or IT processes• Robust: Able to suspend & resume individual workflows, survive machine
reboots• Performant: Connection pooling, workflow throttling, and shared hosting• Scalable: Execute multiple tasks in parallel, common parameters for multi-
machine• Reliable: Automatic connection and action retry with configurable intervals• Familiar: Author workflows as PowerShell scripts or using XAML, manage as
PSJobs
Scheduled Jobs• Job Scheduling allows you to schedule the
execution of a PowerShell background jobSupport for a rich set of triggers
Once at a specific date & timeDaily, weekly, or custom interval (day, week, month)With a specific repetition duration or intervalAt log on, at startup, or with a random delayUnder a different user account
New PSScheduledJob module with 16 cmdlets*-JobTrigger to create scheduled triggers*-ScheduledJob to register, unregister, and change scheduled job definitions*-ScheduledJobOption to configure advanced settings*-Job to retrieve results from scheduled, workflow, and background jobs
Simple & Easy Delegated Administration• Session Configuration Files
• Easy remote endpoint creation• Uses .psd1 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
PowerShell DSCThe “End Game”This technology was the “final destination” in the “Monad Manifesto.” That’s the document written by Windows PowerShell inventory Jeffrey Snover, wherein he described his vision for changing administration in a Microsoft environment.
In some respects, DSC eliminates the need for some administrators to even learn Windows PowerShell. It’s that important.
In the future, expect DSC to be the primary administrative interface for Microsoft products and services.
DSC Architectural Overview
Calls
MOF onTarget Node
DSC Resourcesspecialized
Windows PowerShell modulesPu
shed
Compiled
Configuration ScriptMyConfig.ps1
MOFSERVER2.mof
Authoring Deployment
Two Deployment ModesPushUse Start-DscConfiguration to copy MOF to target node(s). Node(s) evaluate configuration immediately and again every 15 minutes (by default). Manual process. Non-core DSC resources must be manually deployed to nodes.
PullUse push mode to enroll target node(s), configuring them with their pull server information. Target node(s) check the pull server every 30 minutes (default) and re-apply configuration. MOF files must be copied to pull server, and must be accompanies by a checksum file.DSC resources must be ZIPped and placed on pull server. Nodes will copy down any resources they are missing.
Service Management Automation
• Process automation tool• Built on foundation of PowerShell Workflows• Native Integration with Windows Azure Pack• Feature of System Center Orchestrator• Unit of automation = Runbook• Runbook written with PowerShell Workflow• Globally available assets• HA and Scalable infrastructure