Author Posts

September 16, 2015 at 11:52 am

Trying to deploy a simple dsc mof to a test environment. This is a new 2012 R2 lab server. I created a simple configuration script using xComputerManagement and xPSDesiredStateConfiguration.

Configuration StandardWeb{
    param(
        [parameter(Mandatory=$true)]
        [String] $computerName
        
        #[Parameter(Mandatory)] 
        #[pscredential]$domainCredential
        )
    #Import the required DSC Resources  
    Import-DscResource -Module xComputerManagement 
    Import-DscResource -Module xPSDesiredStateConfiguration

    Node $computerName{
        
        WindowsFeature WEBRoles{
            Name = {'FileAndStorage-Services','File-Services','FS-FileServer','Storage-Services','Web-Server'}
            Ensure = 'Present'
        }

        xComputer SetComputerName{
            Name = $computerName
        }

        xService DisableFirewallService{
            Name = 'Windows Firewall'
            State = 'Stopped'
            StartupType = 'Disabled'
        }
    }
}

StandardWeb -OutputPath C:\

The mof file creates just fine. On the test server, I download and install the WMF 5 preview, along with the DSC Resource Kit Wave 10 and extract the modules. I've tried putting the modules in both places, C:\Program Files\WindowsPowerShell\Modules and C:\Windows\System32\WindowsPowerShell\v1.0\Modules.

Each time I try to start-dscconfiguration on the mof I get the following error.

The PowerShell DSC resource MSFT_RoleResource from module  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
    + PSComputerName        : IMWTEST1

I realize this is telling me that the psDesiredStateConfiguration module isn't there, but I can do a get-dscresource and see that it is indeed there. Both the xPsDesiredStateConfiguration and the regular PSDesiredStateConfiguration.

Can someone offer some assistance in tracking down why this server can't seem to find either of these modules?

September 18, 2015 at 1:11 am

I'm not sure Wave 10 is what you should be using for the latest WMF5 code. Have you tried pulling the modules using PowerShellGet? Since MS has moved the code to GitHub, they've not updated the old DSC Resource Kit.

September 18, 2015 at 5:37 am

I tried to get PowerShellGet working but there was something wrong with the TLS connection (I think on my side) preventing me from getting it to work. I'll try to redo things and manually pull down the modules from GitHub if that's where the current code resides.

September 18, 2015 at 7:08 pm

Make sure you know what you're doing. What's in Git is the dev branch and isn't necessarily stable. Be sure you're not just downloading the latest versions of files.