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;