DSC Pull Server WMF 5 - node cant pull configuration or dscresource
hi
i have think working pull server on ms server 2012r2 wmf 5 installed. node is running ms server 2012r2 wmf 5.
can access pull server's site (xml) without issues on both pull server (vm01) , node (vm08) want pull configurations.
setup based on the https://msdn.microsoft.com/en-us/powershell/dsc/pullserver :
pull server:
$configurationdata = @{ allnodes = @( @{ nodename="*" psdscallowplaintextpassword=$true psdscallowdomainuser = $true } @{ nodename='localhost' } ) } #https://msdn.microsoft.com/en-us/powershell/dsc/pullserver configuration deploydscpullserver { param ( [string[]]$nodename = 'present', [validatenotnullorempty()] [string] $certificatethumbprint, [parameter(mandatory)] [validatenotnullorempty()] [string] $registrationkey ) import-dscresource -modulename xpsdesiredstateconfiguration import-dscresource –modulename psdesiredstateconfiguration node $allnodes.nodename { windowsfeature dscservicefeature { ensure = 'present' name = 'dsc-service' } windowsfeature iismgmtconsole { ensure = 'present' name = 'web-mgmt-console' } xdscwebservice psdscpullserver { ensure = 'present' endpointname = 'psdscpullserver' port = 8080 physicalpath = "$env:systemdrive\inetpub\psdscpullserver" certificatethumbprint = $certificatethumbprint modulepath = "$env:programfiles\windowspowershell\dscservice\modules" configurationpath = "$env:programfiles\windowspowershell\dscservice\configuration" state = 'started' dependson = '[windowsfeature]dscservicefeature' } file registrationkeyfile { ensure = 'present' type = 'file' destinationpath = "$env:programfiles\windowspowershell\dscservice\registrationkeys.txt" contents = $registrationkey } } } #run configuration $mofconfigfile = deploydscpullserver -configurationdata $configurationdata -certificatethumbprint $thumbprint -registrationkey $regkey -outputpath c:\configs\pullserver # creates mof at: $mofconfigdirectory = $mofconfigfile.directoryname ii $mofconfigdirectory #we need create checksum mof path nodes can verify file sizes using on pull server. $mofchecksum = new-dscchecksum -path $mofconfigdirectory #run mof start-dscconfiguration -path $mofconfigdirectory -wait -verbose -force
configuration:
i made simple first file configuration testing purpose. runs fine on node (vm08) when running locally. not able make node pull pull server. testing purpose, i'm not using certificate encryption.
$configurationdata = @{ allnodes = @( @{ nodename="*" psdscallowplaintextpassword=$true psdscallowdomainuser = $true } @{ nodename="vm08" #certificatefile = 'c:\keys\sqlnode.cer' #thumbprint = '42235a417be23adde72f1593bde665106262cf7c' } ) } configuration copytest { import-dscresource –modulename psdesiredstateconfiguration node $allnodes.nodename { file test { destinationpath = 'c:\here\ok.ps1' ensure = 'present' recurse = $true sourcepath = 'c:\ok.ps1' type = 'file' } } } copytest -configurationdata $configurationdata -outputpath c:\configs\targetnodes remove-item 'c:\program files\windowspowershell\dscservice\configuration\*' copy 'c:\configs\targetnodes\vm08.mof' 'c:\program files\windowspowershell\dscservice\configuration' new-dscchecksum -path "c:\program files\windowspowershell\dscservice\configuration\" #test pull using https://gist.github.com/jamesdawson/6787277 - invoke-pullonnode.ps1 cd '\\share\testing' .\invoke-pullonnode.ps1 -computername 'vm08' cd c:\windows\system32
lcm on node (vm08)
actionafterreboot : continueconfiguration agentid : a3e37e75-48e0-11e6-80d9-005056837311 allowmoduleoverwrite : false certificateid : 42235a417be23adde72f1593bde665106262cf7c configurationdownloadmanagers : {[configurationrepositoryweb]pullsrv} configurationid : configurationmode : applyandautocorrect configurationmodefrequencymins : 15 credential : debugmode : {none} downloadmanagercustomdata : downloadmanagername : lcmcompatibleversions : {1.0, 2.0} lcmstate : idle lcmstatedetail : lcmversion : 2.0 statusretentiontimeindays : 10 partialconfigurations : rebootnodeifneeded : true refreshfrequencymins : 30 refreshmode : pull reportmanagers : {[reportserverweb]pullsrv} resourcemodulemanagers : {[resourcerepositoryweb]pullsrv} pscomputername
when try get-dscconfiguration on node (vm08) get:
ps c:\windows\system32> get-dscconfiguration get-dscconfiguration : current configuration not exist. execute start-dscconfiguration command -path parameter specify configuration file , create current configuration first. @ line:1 char:1 + get-dscconfiguration + ~~~~~~~~~~~~~~~~~~~~ + categoryinfo : notspecified: (msft_dsclocalconfigurationmanager:root/microsoft/...gurationmanager) [get-dscconfiguration], cimexception + fullyqualifiederrorid : mi result 1,get-dscconfiguration
any tips welcome!
brgs.
bjørn
figured out doing wrong. when compiling file configuration, mof file named after node (wm08.mof).
i changed mof name configuration name(copytest.mof), created new dscchecksum , put these files in dsc configuration path on pull server. voila. works perfectly.
its cool how can make single mof , apply multiple nodes:p
brgs
bjørn roalkvam
Windows Server > Windows PowerShell
Comments
Post a Comment