MSFT_ScriptResource not found on Windows 10

I have problem with this DSC script which install Git on a remote windows computer. https://gist.github.com/thu2004/8c18ccb692aca38bcc38f791bd868989

It worked fine with remote computer which has Windows 7 but not with Windows 10.

I got this error messages:

The PowerShell DSC resource MSFT_ScriptResource from module  does not exist at the PowerShell module path nor is it register
ed as a WMI DSC resource.
    + CategoryInfo          : InvalidOperation: (root/Microsoft/...gurationManager:String) [], CimException
    + FullyQualifiedErrorId : DscResourceNotFound
    + PSComputerName        : 172.26.138.254

Please help. Thank you.

can you check if $pshome\modules\PsDesiredStateConfiguration\DscResources\MSFT_ScriptResource exist on the target node? Also can paste the full output of Start-Dsc cmdlet?

The files exist.

[172.26.138.254]: PS C:\Users\acs\Documents> dir $pshome\modules\PsDesiredStateConfiguration\DscResources\MSFT_ScriptResource


    Directory: C:\Windows\System32\WindowsPowerShell\v1.0\modules\PsDesiredStateConfiguration\DscResources\MSFT_ScriptResource


Mode                LastWriteTime         Length Name                                                                                                        
----                -------------         ------ ----                                                                                                        
d---s-       2015-07-10     15:11                en-US                                                                                                       
-a---l       2015-07-10     13:01          10293 MSFT_ScriptResource.psm1                                                                                    
-a---l       2015-07-10     13:01            718 MSFT_ScriptResource.schema.mof                                                                              

and the output of Start-Dsc cmdlet is:

     4238 172.26.138.254.mof                                                                                          
The command completed successfully.
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManage
r,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer PCCHITL with user sid S-1-5-21-429541692-4179702007-990879441-1223.
VERBOSE: [ACS8]: LCM:  [ Start  Set      ]
VERBOSE: [ACS8]: LCM:  [ End    Set      ]
The PowerShell DSC resource MSFT_ScriptResource from module  does not exist at the PowerShell module path nor is it register
ed as a WMI DSC resource.
    + CategoryInfo          : InvalidOperation: (root/Microsoft/...gurationManager:String) [], CimException
    + FullyQualifiedErrorId : DscResourceNotFound
    + PSComputerName        : 172.26.138.254
 
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 0.618 seconds
The command completed successfully.
The command completed successfully.

I’ve tried it from a Windows Server 2012 R2 to a Windows 10 1511 (10586), it worked smoothly.

Can you try to trace the Start-DscConfiguration execution:

Enable-PsWsmanCombinedTrace
Start-DscConfiguration .\InstallGit -Verbose -Wait -Force -ComputerName $computer -Credential $cred
Disable-PsWsmanCombinedTrace

Afterwards check for related errors in these event logs:
Microsoft/Windows/Windows Remote Management/PowerShell
Microsoft/Windows/Windows Remote Management/Operational

I tried Enable-PsWsmanCombinedTrace and the event log (Microsoft/Windows/Windows Remote Management/Operational) only has one error message: "
The PowerShell DSC resource MSFT_ScriptResource from module does not exist…"

Enable-PsWsmanCombinedTrace
Start-DscConfiguration .\InstallGit -Verbose -Wait -Force -ComputerName $computer -Credential $cred
Disable-PsWsmanCombinedTrace

Can you capture the output of Get-Dscresource? Based on the verbose messages this error is coming during discovery of the resource.

Here is the output of Get-DscResource. NOTE that File and Log resource work fine. Is that they are Implemented as Binary not as Powershell.

PS R:\> Invoke-Command -ComputerName $computer -Credential $cred -ScriptBlock { Get-DscResource }

ImplementedAs   Name                      ModuleName                     Version    Properties                                         PSComputerName        
-------------   ----                      ----------                     -------    ----------                                         --------------        
Binary          File                                                                {Microsoft.PowerShell.DesiredStateConfiguration... 172.26.23.185         
PowerShell      cTentacleAgent            OctopusDSC                     1.0        {Microsoft.PowerShell.DesiredStateConfiguration... 172.26.23.185         
PowerShell      Archive                   PSDesiredStateConfiguration    1.1        {Microsoft.PowerShell.DesiredStateConfiguration... 172.26.23.185         
PowerShell      Environment               PSDesiredStateConfiguration    1.1        {Microsoft.PowerShell.DesiredStateConfiguration... 172.26.23.185         
PowerShell      Group                     PSDesiredStateConfiguration    1.1        {Microsoft.PowerShell.DesiredStateConfiguration... 172.26.23.185         
Binary          Log                       PSDesiredStateConfiguration    1.1        {Microsoft.PowerShell.DesiredStateConfiguration... 172.26.23.185         
PowerShell      Package                   PSDesiredStateConfiguration    1.1        {Microsoft.PowerShell.DesiredStateConfiguration... 172.26.23.185         
PowerShell      Registry                  PSDesiredStateConfiguration    1.1        {Microsoft.PowerShell.DesiredStateConfiguration... 172.26.23.185         
PowerShell      Script                    PSDesiredStateConfiguration    1.1        {Microsoft.PowerShell.DesiredStateConfiguration... 172.26.23.185         
PowerShell      Service                   PSDesiredStateConfiguration    1.1        {Microsoft.PowerShell.DesiredStateConfiguration... 172.26.23.185         
PowerShell      User                      PSDesiredStateConfiguration    1.1        {Microsoft.PowerShell.DesiredStateConfiguration... 172.26.23.185         
PowerShell      WaitForAll                PSDesiredStateConfiguration    1.1        {Microsoft.PowerShell.DesiredStateConfiguration... 172.26.23.185         
PowerShell      WaitForAny                PSDesiredStateConfiguration    1.1        {Microsoft.PowerShell.DesiredStateConfiguration... 172.26.23.185         
PowerShell      WaitForSome               PSDesiredStateConfiguration    1.1        {Microsoft.PowerShell.DesiredStateConfiguration... 172.26.23.185         
PowerShell      WindowsFeature            PSDesiredStateConfiguration    1.1        {Microsoft.PowerShell.DesiredStateConfiguration... 172.26.23.185         
PowerShell      WindowsOptionalFeature    PSDesiredStateConfiguration    1.1        {Microsoft.PowerShell.DesiredStateConfiguration... 172.26.23.185         
PowerShell      WindowsProcess            PSDesiredStateConfiguration    1.1        {Microsoft.PowerShell.DesiredStateConfiguration... 172.26.23.185   
This DSC configuration works as it only has Log and File Resource.

See this gist https://gist.github.com/thu2004/737a04a96460ef4a9137722d05827864

Script resource is discoverable, there is something else going on.
In your configuration can you explicitly use Version 1.1 of the module and try
Import-DscResource –ModuleName ‘PSDesiredStateConfiguration’ -ModuleVersion 1.1 and then run the scenario.

Hi Nitin,

By explicitly specify version 1.1 did work but do not understand why.

Import-DscResource –ModuleName ‘PSDesiredStateConfiguration’ -ModuleVersion 1.1

Hm, I’m just curious, do you have multiple versions of the PSDesiredStateConfiguration module installed? You can check with this command:

Get-Module PSDesiredStateConfiguration -ListAvailable

The PSDesiredStateConfiguration module version in Powershell v4 is 1.0 and PowerShell v5 is 1.1. On Win10 Client, as a compilation node, depending upon the content of the configuration ,ModuleVersion may be pointed towards either 1.0 or 1.1 to satisfy the compatibility with Powershell V4 target node. On PowerShell V5 you will only see Module Version 1.1 present on the system and LCM does the re-routing of Module Version 1.0 to 1.1 and process it accordingly. There seems to be an issue in LCM re-routing module version 1.0 to 1.1 in some conditions hence explicitly specifying module version fixes the issue. This issue doesn’t exist in WMF 5.0 RTM.