Error when applying PowerShell DSC configuration
Asked Answered
A

1

6

I have a simple PowerShell DSC configuration block that ensures that a user account does not exist, and when I attempt to apply it to the local system using Start-DscConfiguration, I am receiving an error message similar to the following:

The WS-Management service cannot process the request. The WMI service returned an 'access denied' error.

How can I apply the DSC configuration successfully?

Here is the configuration block I am using:

configuration MyConfig {
    User Trevor2 {
        UserName = 'Trevor2';
        Ensure = 'Absent';
    }
}

$Path = 'c:\dsc\MyConfig';
MyConfig -OutputPath $Path;

Start-DscConfiguration -Wait -Verbose -Path $Path;
# Clean up MOF files
Remove-Item -Path $Path -Recurse;
Alkyne answered 29/8, 2014 at 1:4 Comment(0)
A
9

Make sure that the PowerShell console host or PowerShell Integrated Scripting Editor (ISE) is running under your administrative Windows token, if UAC is enabled. Applying PowerShell DSC configurations requires that you be an Administrator by default.

Alkyne answered 29/8, 2014 at 1:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.