Cant import DSCresource

Hi Using MS server 2012R2 with WMF 5.

I have created a configuration to install SQL and SharePoint.
I have configured a LCM on my dev Node machine to pull the configuration from a Pull server. It did so flawlessly.

However after testing an updated configuration (Adding sharepoint service pack 1 as a package DSCresource). I now get multiple import-dscresource errors on the node. Here i listed the first one:

Could not import the PowerShell DSC resource: C:\Program Files\WindowsPowerShell\Modules\xWindowsUpdate\2.5.0.0\DscResources\MSFT_xWindowsUpdate
    + CategoryInfo          : ResourceUnavailable: (:) [], CimException
    + FullyQualifiedErrorId : PsproviderImportFailure
    + PSComputerName        : localhost 


PS C:\Windows\system32> Get-DscResource -module xwindowsupdate

ImplementedAs   Name                      ModuleName                     Version    Properties                                        
-------------   ----                      ----------                     -------    ----------                                        
PowerShell      xHotfix                   xWindowsUpdate                 2.5.0.0    {Id, Path, Credential, DependsOn...}              
PowerShell      xMicrosoftUpdate          xWindowsUpdate                 2.5.0.0    {Ensure, DependsOn, PsDscRunAsCredential}         
PowerShell      xWindowsUpdateAgent       xWindowsUpdate                 2.5.0.0    {IsSingleInstance, Source, Category, DependsOn...} 


PS C:\Windows\system32> Get-Module -ListAvailable xWindowsUpdate


    Directory: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands                                                                                                                                                                  
---------- -------    ----                                ----------------                                                                                                                                                                  
Manifest   2.5.0.0    xWindowsUpdate  

Any ideas to what can be causing this?
I tried removing all modules on the node, so that it pulls new modules from the pull server, but I am getting the samme import errors.

brgs

Bjørn

I attempted to remove downloaded modules on the pull server (both dsc module folder and normal module folder) and on the node. Then download and install them again on the Pull Server using the find-dscresource xxxx | install-module… cmlet and packing them correctly in the DscService\Modules folder.

The node pulling the configuration got the same errors… So it does not seem to be an issue with the modules themselves…
And only 3 of 8 modules give me the error similar to:

Could not import the PowerShell DSC resource: C:\Program Files\WindowsPowerShell\Modules\xWindowsUpdate\2.5.0.0\DscResources\MSFT_xWindowsUpdate
    + CategoryInfo          : ResourceUnavailable: (:) [], CimException
    + FullyQualifiedErrorId : PsproviderImportFailure
    + PSComputerName        : localhost 

To be clear, this isn’t a “not found” error, it’s an “import error.” It’s finding the file = it just can’t import it for some reason. The only way to troubleshoot that is to open a console on the node and manually try to import the resource, using -verbose, to see if you can get any errors. Either that, or enable debugging on the node, run it all again, and check the Diagnostics log to see if you get anything more specific. There’s something IN the module that the node isn’t liking. For example, have you checked the ExecutionPolicy?

+1 to what Don Jones has said.
Additional questions

  1. Are you able to import the modules themselves (not the resources) on the VM?
  2. Where are these modules coming from - PowerShell Gallery/your own development?

Hi Don
Thank you very much!
It was surely enough the executon-policy that was giving me the headache.

PS C:\Windows\system32> Get-ExecutionPolicy
Restricted 

Setting to remotesigned or unrestricted fixed the import issue!

brgs

Bjørn