Remote Start-DscConfiguration cannot find DSC resources

This topic contains 6 replies, has 4 voices, and was last updated by  Ken Sykora 3 months ago.

  • Author
    Posts
  • #28184

    Adam Weigert
    Participant

    I'm writing a "push" script for testing that copies the modules of a MOF to the C:\Program Files\WindowsPowerShell\Modules path of a remote host then executes a Start-DscConfiguration with the ComputerName parameter.

    It seems when I try to apply the MOF remotely it tells me one of the modules (xNetworking) does not exist yet if I use Invoke-Command against the computer and do Get-Module xNetworking -ListAvailable it shows and Get-DscResource shows all the resources from the copied modules.

    The MOF file is on my local machine, I'm using this to start it, assuming I don't need the copy the MOF file to the remote machine and the path is a local path and not one that is remote.

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

    Any thoughts on possible causes? The MOF applies fine when run locally on the remote machine, I'd really like to be able to initiate this remotely though without having to be on the machine.

    Update: The MOF doesn't apply locally, my bad it receives the same thing but the xNetworking module definitely does exist and is returned in the Get-DscResource cmdlet output.

  • #28189

    Dave Wyatt
    Moderator

    What's the name of your MOF file? It needs to be .mof, even when you're using the -ComputerName parameter of Start-DscConfiguration.

  • #28191

    Adam Weigert
    Participant

    Yes it is a MOF, COMPUTERNAME.mof and I'm using

    Start-DscConfiguration -ComputerName COMPUTERNAME -Path .\Output -Wait -Force -Verbose

    Running the same command with the MOF file locally produces the same error

    Start-DscConfiguration -Path .\Desktop -Wait -Force -Verbose

    xNetworking version is 2.2.0 and I'm only using the xIPAddress resource. This works on other servers. And again like I said it shows the resources and modules in PowerShell.

  • #28201

    Adam Weigert
    Participant

    Found this: http://blogs.msdn.com/b/powershell/archive/2013/12/26/holiday-gift-desired-state-configuration-dsc-resource-kit-wave-1.aspx that stated rebooting helps solve this problem.

    It did resolve the issue, wondering what needed recycled with the reboot to pick up the new modules.

  • #28406

    Chris Smith
    Participant

    I just found the same thing happened to me regarding needing a reboot. I installed the modules to the right location and they appeared when I did a get-dscresource, but I kept getting errors when I tried to use one. Rebooted and it went through the first time.

  • #28408

    Dave Wyatt
    Moderator

    I've also run into this problem, and have found that placing my DSC resource modules into $pshome instead of Program Files works around it. (I know this is not a recommended Microsoft practice, but IMO, I'd rather have things just work, without a reboot, than honor etiquette, in this case.)

  • #79414

    Ken Sykora
    Participant

    I just ran into this same issue. The resolution for me ultimately was _not_ restarting, but following @dave Wyatt's advice and installing the module with `-Scope AllUsers`. Oddly enough, it was working just fine yesterday with `-Scope CurrentUser` so I imagine there is some odd bug going on with DSC here.

You must be logged in to reply to this topic.