4

I couldn't find this on the interwebs and it seems like a obvious use case to me

Is it possible run Windows Desired State Configuration / DSC on a Windows 10 workstation?

For example, setting up IIS websites on development machines using DSC in "Push" mode against localhost

Colyn1337
  • 2,387
  • 2
  • 22
  • 38
KCD
  • 878
  • 3
  • 11
  • 23

1 Answers1

3

No.

The internet implies it might be so trying it out, but boy there is a lack of good simple quick start guides so here is what I tried:

# TestDSC.ps1
Configuration TestDSC
{
    Import-DscResource -Module PSDesiredStateConfiguration, xWebAdministration

    WindowsFeature IIS
    {
        Ensure          = "Present"
        Name            = "Web-Server"
    }
    Node localhost
    {
        xWebsite DefaultSite
        {
            Ensure          = "Present"
            Name            = "Default Web Site"
            State           = "Stopped"
            PhysicalPath    = "C:\inetpub\wwwroot"
        }
    }
}

Then run in Powershell:

 .\TestDSC.ps1
 TestDSC

And this should output a localhost.mof in a TestDSC directory

Run in push mode:

Start-DscConfiguration -Wait -Verbose TestDSC

Fails without WinRM

The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig".

But lets try this interesting workaround: https://blogs.technet.microsoft.com/pstips/2017/03/01/using-dsc-with-the-winrm-service-disabled/

$configData = [byte[]][System.IO.File]::ReadAllBytes((Resolve-Path -Path '.\TestDSC\localhost.mof'))
Invoke-CimMethod -Namespace root/Microsoft/Windows/DesiredStateConfiguration -ClassName MSFT_DSCLocalConfigurationManager -Method SendConfigurationApply -Arguments @{ConfigurationData = $configData; force = $true}

Oh no, why didn't you tell me to start with!

PowerShell DSC resource MSFT_RoleResource failed to execute Test-TargetResource functionality with error message: Installing roles and features using PowerShell Desired State Configuration is supported only on Server SKU's. It is not supported on Client SKU.

Windows 10 is not server SKU

Hope this helps save people time, circa 2018 I don't recommend wasting your time investigating any further but look forward to updates from Microsoft (hint hint)

KCD
  • 878
  • 3
  • 11
  • 23
  • so eh, you just cant install features. whats wrong with dsc? – 4c74356b41 Aug 21 '18 at 08:56
  • The question was target a *Windows 10* workstation and this SKU is not permitted. Also try commenting out the `WindowsFeature` block and it will still fail. Happy to be proven wrong but there is virtually no documentation I can find about this use case so I'm trying to share the answers I have found – KCD Aug 22 '18 at 00:22