We are having an issue setting up a Windows 2008 R2 server running PowerShell 4.0 with DSC. It looks like an issue with the PSDesiredStateConfiguration module failing to load. If I try to run any of the DSC cmlets, I get an error that the module cannot be loaded:
PS C:> Get-DscLocalConfigurationManager
Get-DscLocalConfigurationManager : The ‘Get-DscLocalConfigurationManager’ command was found in the module
‘PSDesiredStateConfiguration’, but the module could not be loaded. For more information, run ‘Import-Module
PSDesiredStateConfiguration’.
At line:1 char:1
- Get-DscLocalConfigurationManager
-
+ CategoryInfo : ObjectNotFound: (Get-DscLocalConfigurationManager:String) [], CommandNotFoundException + FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
And if I try to manually import the module, I get the following error:
PS C:> Import-Module PSDesiredStateConfiguration
Import-Module : Cannot process Cmdlet Definition XML for the following file:
C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\Get-DSCConfiguration.cdxml. The type
initializer for ‘Microsoft.PowerShell.Cmdletization.ScriptWriter’ threw an exception.
At line:1 char:1
- Import-Module PSDesiredStateConfiguration
-
+ CategoryInfo : NotSpecified: (:) [Import-Module], XmlException + FullyQualifiedErrorId : System.Xml.XmlException,Microsoft.PowerShell.Commands.ImportModuleCommand
Has anyone run into this before, or know how to resolve it? We already tried re-installing WMF 4.0 and that didn’t work.