This is the error I'm hitting: "The PowerShell provider <module> does not exist at the PowerShell module path nor is it registered as a WMI provider"
I'm not exactly a newbie to PowerShell and DSC, but I'm having a hard time figuring this one out. I have followed the guidance here for troubleshooting. I also found this almost identical question... the only resolution seemed to be rebooting (which I tried).
So I made a configuration which imports a module, OctopusDSC. I left out a lot of parameters during troubleshooting the module import, but here is what I have:
Configuration OctopusServer
{
Import-DscResource -Module OctopusDSC
Node "WIN-ABC123"
{
cTentacleAgent OctopusTentacle
{
Ensure = "Present"
State = "Started"
Name = "Tentacle"
ApiKey = ""
OctopusServerUrl = ""
DefaultApplicationDirectory = "C:\Utility"
}
}
}
The module exists in C:\Program Files\WindowsPowerShell\Modules
both locally and on the server:
C:\>tree "C:\Program Files\WindowsPowerShell\Modules" /f
Folder PATH listing
Volume serial number is 9EC4-62C1
C:\PROGRAM FILES\WINDOWSPOWERSHELL\MODULES
└───OctopusDSC
│ OctopusDSC.psd1
│
└───DSCResources
└───cTentacleAgent
cTentacleAgent.psm1
cTentacleAgent.schema.mof
The module path seems fine (I put carriage returns in at each semi-colon, for readability):
PS C:\> $env:PSModulePath
C:\Users\jasonc\Documents\WindowsPowerShell\Modules;
C:\Program Files\WindowsPowerShell\Modules;
C:\Windows\system32\WindowsPowerShell\v1.0\Modules\;
C:\Program Files\Microsoft Monitoring Agent\Agent\PowerShell
I can call Get-Module
:
PS C:\> Get-Module OctopusDSC -ListAvailable
Directory: C:\Program Files\WindowsPowerShell\Modules
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Manifest 1.0.1 OctopusDSC {Get-TargetResource, Set-TargetResource, Test-TargetResource}
I can call Get-DscResource
:
PS C:\temp> Get-DscResource -Name "cTentacleAgent"
ImplementedAs Name Module Properties
------------- ---- ------ ----------
PowerShell cTentacleAgent OctopusDSC {Name, ApiKey, DefaultApplicationDirectory,...
And this is my error:
PS C:\> Start-DscConfiguration -Path .\OctopusServer -Verbose -WhatIf -Wait
What if: [WIN-ABC123]: LCM: [ Start Set ]
What if: [WIN-ABC123]: LCM: [ End Set ]
The PowerShell provider OctopusDSC does not exist at the PowerShell module path nor is it registered as a WMI provider.
+ CategoryInfo : InvalidOperation: (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : ModuleNameNotFound
+ PSComputerName : WIN-ABC123
Am I missing something??
PS C:\> $PSVersionTable
Name Value
---- -----
PSVersion 4.0
WSManStackVersion 3.0
SerializationVersion 1.1.0.1
CLRVersion 4.0.30319.34014
BuildVersion 6.3.9600.16394
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0}
PSRemotingProtocolVersion 2.2
Update
I noticed this problem happens on machines with Microsoft Monitoring Agent installed, but does not happen if that agent is not installed.
After the install, the PSModulePath machine-level environment variable looks like this (split for clarity):
PS C:\> [environment]::GetEnvironmentVariable("PSModulePath","Machine")
C:\Windows\system32\WindowsPowerShell\v1.0\Modules\;
C:\Program Files\Microsoft Monitoring Agent\Agent\PowerShell
If I remove the agent's path, and only leave C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
in there, OctopusDSC is found. I do have to restart WMI Provider Host process to get the environment variable change to take. If I add the path back in... fail.
Now this is confusing to me because the whole time the actual path the module is installed in is C:\Program Files\WindowsPowerShell\Modules
, and that is presumbably added to the calculated PSModulePath
by PowerShell itself (I assume that because I typically don't see that path set up in the system environment variables).
I have seen elsewhere that duplicating C:\Program Files\WindowsPowerShell\Modules
in PSModulePath
can cause problems with module resolution. So maybe there are other bugs and sensitivities around it?
I feel like this is kind of an answer, but I am still looking for a workaround, as removing that path is not preferred.
Get-DscResource
to see if it can discover cTentacleAgent.Get-Module
will only show it's container, not the resource. The problem implies the resource is somehow invalid and I would probably start by checking your PowerShell version (reasonably expectations and all that). – ThriftC:\Windows\System32\WindowsPowerShell\v1.0\Modules
and it wasn't in there. And user directory doesn't have any modules. – Insectivore