Author Posts

August 19, 2016 at 9:58 am

Hi Using Server 2012 R2 with WMF 5.
I have created a configuration that installs SQL2014 and SharePont2013 on a node.
My node's are registred with the Pull Server by using a Registrationkey.

At this point i have been renaming the mof file that is created by the configuration to configurationName.mof.
I can set my node's LCM to pull this configurationName.mof and this works fine.

When I add multiple nodes to my AllNodes @() configurationdata table, then run the configuration, it will create a mof file per node.
What I want is a single mof that can pulled by all my nodes, specifying its configuration when setting the node's LCM. How can I accomplish this? I have tried naming a single node as 'localhost' but seem to get a few errors on when DSC is configuring SharePoint on my node.

Am I going about this wrong?



August 19, 2016 at 10:21 am

Is it possible to create one Configuration that has multiple nodes (with spesific roles for example; 1 node is SQL, 1 is SharePoint) and keep this as a single configurationName.mof file? Or is it required to use one mof file per node when having different roles per node?



August 19, 2016 at 11:53 am

The fault i get when using 'localhost' in my allnodes configurationdata is as follows:

VERBOSE: [vm09]:                            [[xSPCreateFarm]CreateSPFarm] Creating a new farm with config db SP_Config content db SP_AdminContent server localhost\sql2014 for farm mode
localhost is an invalid or loopback address.  Specify a valid server address.
    + CategoryInfo          : InvalidData: (Microsoft.Share...urationDatabase:) [], CimException
    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletNewSPConfigurationDatabase
    + PSComputerName        : localhost

VERBOSE: [vm09]:                            [[xSPCreateFarm]CreateSPFarm] Leaving ProcessRecord Method of New-SPConfigurationDatabase.
VERBOSE: [vm09]:                            [[xSPCreateFarm]CreateSPFarm] Leaving EndProcessing Method of New-SPConfigurationDatabase.
VERBOSE: [vm09]:                            [[xSPCreateFarm]CreateSPFarm] Leaving BeginProcessing Method of Install-SPHelpCollection.
VERBOSE: [vm09]: LCM:  [ End    Set      ]  [[xSPCreateFarm]CreateSPFarm]  in 5.4220 seconds.
PowerShell DSC resource MSFT_xSPCreateFarm  failed to execute Set-TargetResource functionality with error message: Cannot access the local farm. Verify that the local farm is properly configured, currently available, and that you have
the appropriate permissions to access the database before trying again. 
    + CategoryInfo          : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : ProviderOperationExecutionFailure
    + PSComputerName        : localhost

The SendConfigurationApply function did not succeed.
    + CategoryInfo          : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException
    + FullyQualifiedErrorId : MI RESULT 1
    + PSComputerName        : localhost 

Ive found some indication that this issue tied to using localhost instead of hostname or ip in the Configuration allnodes data.

August 19, 2016 at 1:23 pm

Can you paste your allnodes config? There shouldn't be anything stopping you from putting both the SQL and SharePoint config in the one MOF. But from from just what you've posted though I personally would be looking at using partial configs then telling the LCM to just pull the SQL one first and set a depends on the SQL one for SharePoint.

August 19, 2016 at 6:10 pm


When dealing with ConfiguraionNames you have to make one distinct settings and that's using localhost
as the node name. If you use the real node name, that's what will show inside the mof file, no matter how you call the file itself.

The mof has to be node agnostic and it doesn't care what the node name is. All of your node scripts should thus be referring to localhost inside, and rename the mof file based on the various "roles".

If you generate a checksum file as part of your script in an automatic way, you have to rename the mof file prior to the checksum.

  • This reply was modified 2 years, 1 month ago by  Arie H.
  • This reply was modified 2 years, 1 month ago by  Arie H.

August 26, 2016 at 11:56 am

Thank you for the replies.

I've read a lot about this and decided that perhaps speficying my nodes, data and accounts in the configuration data is the right way to go for me. This is because that my Mofs will contain custom data anyway (User accounts for credential and so on.). Then they might as well contain nodes data via the configuration data.
I will use roles per server to controll what settings are applied to them.
When running such a configuration it will produce one mof per node as expected. In my case 1 SQL, 2 SharePoint Back-end and 2 SharePoint Front-end, 5 mofs.

If i want these pulled by my WMF 5 server, what names do I give the mofs?
(So all nodes are WMF 5 and i used registrationkey).

And what will setting the LCM contain? ConfigurationNames at all?

My initial LCM Configuration (using configurationNames) is as follows:

$Remotenode = 'vm10'
$PullServer = 'PullServer'

$RegkeyFromLocation = Get-Content 'C:\Program Files\WindowsPowerShell\DscService\RegistrationKeys.txt'

$NodeCertificate = ""
$NodeThumbprint = (Dir Cert:\LocalMachine\root | ? {$_.Subject -eq "CN=*.$NodeCertificate"}).Thumbprint 

#Bruker registrationkey fra over.
configuration PullClientConfigID
        param (
        [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [array] $NodeName,
        [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string] $PullServer,
        [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string] $NodeThumbprint,
        [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string] $RegistrationKey

    Node $NodeName
            RefreshMode          = 'Pull'
            RefreshFrequencyMins = 90 
            RebootNodeIfNeeded   = $true
            AllowModuleOverwrite = $true
            ConfigurationMode = "ApplyAndAutocorrect"
            CertificateID = $NodeThumbprint


        ConfigurationRepositoryWeb PullSrv
            ServerURL          = "https://$PullServer"+":8080/PSDSCPullServer.svc"
            RegistrationKey    = $RegkeyFromLocation

            ConfigurationNames = @('SQLSharePointInstall')

        ReportServerWeb PullSrv
            ServerURL       = "https://$PullServer"+":8080/PSDSCPullServer.svc"
            RegistrationKey = $RegkeyFromLocation

        ResourceRepositoryWeb PullSrv
            ServerURL = "https://$PullServer"+":8080/PSDSCPullServer.svc"
            RegistrationKey = $RegkeyFromLocation




August 26, 2016 at 7:40 pm

I might have understood this in a wrong way but from your explanation, one mof pernode, means you will not use multiple values in the ConfigurationNames, just one value which is the role/node itself.

So if you have a server that is your IIS server for example, called vm10, as in your example, the results of your script will be vm10.mof, you can then choose what ever name you want to rename the vm10.mof, say myIIS.mof and in yourLCM script you set ConfigurationNames to be myIIS. Then you create the checksum for the myIIS.mof.

Note that you will NOT be able to use myIIS.mof for any other node.
As it has, hardcoded inside the mof, the node name: vm10.

When you want one mof per server, it serves little use to rename the mof file to a "friendly name" as leaving it to be vm10.mof and using vm10 in the ConfigurationNames is suitable enough.

Renaming mofs to friendly names would only be logical if you have multiple mof files you want applied on same node and as I noted in my last answer localhost as your node name.

P.S. if youre using the same pull server for Configuration/Reporting and for Resources, you dont need to have the 'ResourceRepositoryWeb PullSrv' inyour script.

  • This reply was modified 2 years ago by  Arie H. Reason: added the P.S. section

August 28, 2016 at 5:40 am

Hi Arie,

I was thinking multiple values in the configuration data, like the example found on :

$MyData = 
    AllNodes = 
            NodeName           = "*"
            LogPath            = "C:\Logs"

            NodeName = "VM-1"
            Role     = "WebServer"
            SiteContents = "C:\Site1"
            SiteName = "Website1"

            NodeName = "VM-2"
            Role     = "SQLServer"

            NodeName = "VM-3"
            Role     = "WebServer"
            SiteContents = "C:\Site2"
            SiteName = "Website3"

    NonNodeData = 
        ConfigFileContents = (Get-Content C:\Template\Config.xml)

configuration MyConfiguration
    Import-DscResource -ModuleName xWebAdministration -Name MSFT_xWebsite

    node $AllNodes.Where{$_.Role -eq "WebServer"}.NodeName
        xWebsite Site
            Name         = $Node.SiteName
            PhysicalPath = $Node.SiteContents
            Ensure       = "Present"

        File ConfigFile
            DestinationPath = $Node.SiteContents + "\\config.xml"
            Contents = $ConfigurationData.NonNodeData.ConfigFileContents

The above configuration will produce 3 mofs:
VM-1 (WebServer)
VM-2 (SQL)
VM-3 (WebServer)

Is there a way to do the same with only one MOF as an output? Also consider multiple user-credentials in the configuration data to install and run SQL and the web-servers.
And if the Web-servers are a SharePoint farm, they are dependent of each other, meaning the first web-server will create the SharePoint farm, while the second will join it. I will have to specify farm password, node names, service account credentials for the different services and so on in the configuration data. This cant be done by generating a generic localhost configuration can it?

So anyway I currently see it, i will get more than one MOF. So if this is correct. How would i name these MOFs so they can be pulled by my nodes LCM ?



August 28, 2016 at 9:00 am

Q: Is there a way to do the same with only one MOF as an output?

A: Nope. The idea of one MOF file per role is that all nodes have the SAME configuration.
In your example VM-1 and VM-3 do not have the same configuration even if you set them both to Role = "WebServer"
as the SiteContents and SiteName are different.

Once you run the DSC command and create the 3 mof files, you can leave their names as is and in the node LCM script,
use the mof file name as a value for the ConfigurationName (one mof per node)

There's no point renaming the mof files to anything else as they are hardcoded for specific node name inside.

As for the SharePoint question, if you have two servers that are identical, then you can use the same mof for both, if
originally you used localhost for them. If you want DSC to control the execution order, you'll need to use the DependsOn and the WaitFor resources.

Potentially you could have given them different Roles and then used localhost as the NodeName,
however NodeNames have to be unique in the same configuration script, which means one script per role that you
will then run independently and make sure they don't write to the same output folder as they will both create
localhost.mof and we don't want them overwriting.

August 28, 2016 at 9:40 am

Thank you Arie, that makes sense.