Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

PowerShell v4 Desired State Configuration


Published on

Microsoft very recently announced that Windows Server 2012 R2 and PowerShell v4 will ship Desired State Configuration as mechanism to declaratively define the components to be installed + configured on a Windows system, and then automatically apply that state to a set of machines or detect variations in existing deployments.

Jason will talk about how it will work, how you will be able to use it, and what you can do today to prepare.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

PowerShell v4 Desired State Configuration

  1. 1. PowerShell v4 Desired State Configuration
  2. 2. Windows does not work that way! •Win32 API •COM •WMI •.NET
  3. 3. PowerShell is … • .NET underneath • Structured data and behaviours • Objects in, objects out • A dynamic COM client • A WMI/CIM native • … capable of text manipulation and Regular Expressions too
  4. 4. PowerShell Desired State Configuration is … • New language KeywordsKeywords to declaratively define ConfigurationsConfigurations • Configurations that compile to Managed Object Format (MOF) • DSC ProvidersDSC Providers to apply Configurations to ResourcesResources • New CmdletsCmdlets to test, apply, and restore Configurations on demand • Local Configuration ManagerLocal Configuration Manager to maintain config and PullPull updates • DSC ServiceDSC Service to host Configurations and Providers centrally for Pull • Available in-the-box with Windows Server 2012 R2 on October 18th
  5. 5. Built-in Resources include … •Archive •Environment •File •Group •Log •Package •WindowsProcess •Registry •WindowsFeature •Script •Service •User
  6. 6. Configuration DemoConfig { param (…) Node localhost { WindowsFeature Telnet { Ensure = 'Present' # or 'Absent' Name = 'Telnet-Client' } } }
  7. 7. instance of MSFT_RoleResource as $MSFT_RoleResource1ref { ResourceID = "[WindowsFeature]Telnet"; Ensure = "Present"; SourceInfo = "::6::9::WindowsFeature"; Name = "Telnet-Client"; ModuleName = "MSFT_RoleResource"; ModuleVersion = "1.0"; }; instance of OMI_ConfigurationDocument { … };
  8. 8. Local Configuration Manager • Responsible for validating and applying configuration • Runs under the context of the SYSTEM account • Only Administrators can submit configuration • Defaults to running in Push mode on a clean OS / PSv4 install • Supports Pull mode via file share or web service • Pull mode handles custom Resource Provider deployment • A single MOF file must encompass all the configuration
  9. 9. PS /> Start- DscConfiguration
  10. 10. DSC Service • An IIS-hosted OData web service • An optional feature in Server 2012 R2 • Consists of two components: • The Pull Server • The Compliance Server • No documentation yet
  11. 11. Custom DSC Providers • Custom Resources are a formalisation of the Script Resource: • Get-TargetResource • Set-TargetResource • Test-TargetResource • MOF Schema with a Key and properties • Existing examples: • DHCP (by @gpduck) • Hosts file (on • Website (in the Hands-On Lab) • Expect to develop custom resources as an early adopter
  12. 12. What about System Center? • Configuration Manager is expected to be used by the Enterprise. DSC is expected to be used for Azure and for DevOps. • Virtual Machine Manager 2012 R2 can call DSC during provisioning
  13. 13. With DSC, Windows becomes text files •Versionable •Indexable •Auditable •Self-documenting
  14. 14. Without DSC, follow the same principals • Idempotency • Separate intent from implementation • Separate environmental configuration differences • Server names • Credentials • Number machines per role
  15. 15. Jason Stangroome @jstangroome