# DSC Cannot import PSDesiredStateConfiguration module

**URL:** <https://forums.powershell.org/t/dsc-cannot-import-psdesiredstateconfiguration-module/4987>\
**Category:** DSC\
**Created:** [October 7, 2015, 4:20am UTC](https://forums.powershell.org/t/dsc-cannot-import-psdesiredstateconfiguration-module/4987 "2015-10-07T04:20:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![matt-mcelreath](https://avatars.discourse-cdn.com/v4/letter/m/a3d4f5/32.png) [@matt-mcelreath](https://forums.powershell.org/u/matt-mcelreath)\
**Post date:** [October 7, 2015, 4:20am UTC](https://forums.powershell.org/t/dsc-cannot-import-psdesiredstateconfiguration-module/4987/1 "2015-10-07T04:20:09Z")

</div>

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:&gt; 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
- 

```auto
  + CategoryInfo : ObjectNotFound: (Get-DscLocalConfigurationManager:String) [], CommandNotFoundException
  + FullyQualifiedErrorId : CouldNotAutoloadMatchingModule

```

And if I try to manually import the module, I get the following error:

PS C:&gt; 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
- 

```auto
  + 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.

---

<div class="post-metadata">

**Author:** ![donj](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/donj/32/137_2.png) [@donj](https://forums.powershell.org/u/donj)\
**Post date:** [October 7, 2015, 6:19am UTC](https://forums.powershell.org/t/dsc-cannot-import-psdesiredstateconfiguration-module/4987/2 "2015-10-07T06:19:34Z")

</div>

Have you installed the rollup hot fix for WMF4?

---

<div class="post-metadata">

**Author:** ![matt-mcelreath](https://avatars.discourse-cdn.com/v4/letter/m/a3d4f5/32.png) [@matt-mcelreath](https://forums.powershell.org/u/matt-mcelreath)\
**Post date:** [October 7, 2015, 6:25am UTC](https://forums.powershell.org/t/dsc-cannot-import-psdesiredstateconfiguration-module/4987/3 "2015-10-07T06:25:30Z")

</div>

I don’t believe so. I’ll have to check. Where would I find that. I did a quick search but couldn’t find it.

---

<div class="post-metadata">

**Author:** ![donj](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/donj/32/137_2.png) [@donj](https://forums.powershell.org/u/donj)\
**Post date:** [October 7, 2015, 6:34am UTC](https://forums.powershell.org/t/dsc-cannot-import-psdesiredstateconfiguration-module/4987/4 "2015-10-07T06:34:01Z")

</div>

It’s perhaps easiest to make sure the machine is completely patched ;). I’m not in a good position to look it up right now, but I’ll try to later on this evening.

---

<div class="post-metadata">

**Author:** ![matt-mcelreath](https://avatars.discourse-cdn.com/v4/letter/m/a3d4f5/32.png) [@matt-mcelreath](https://forums.powershell.org/u/matt-mcelreath)\
**Post date:** [October 8, 2015, 7:25am UTC](https://forums.powershell.org/t/dsc-cannot-import-psdesiredstateconfiguration-module/4987/5 "2015-10-08T07:25:42Z")

</div>

Something must have been hosed in .NET. Uninstalling WMF 4, then uninstalling .NET and re-installing both seems to have fixed the issue.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 9:17pm UTC](https://forums.powershell.org/t/dsc-cannot-import-psdesiredstateconfiguration-module/4987/6 "2024-05-16T21:17:12Z")

</div>

Closed on May 16, 2024, 9:17pm UTC


