[PowerShell] Getting started with Windows PowerShell Desired State Configuration – Part 2 – Pull Server

After the introduction with DSC I got exited of possibilities, so what’s next?

Setting up a PS DSC Pull Server is the next step. I had some issues with the Pull Server installation on Windows 2008 R2, so I try to keep it simple and deployed a Windows 2012 R2 server. Maybe I will try later on to install the DSC Pull Server on Windows 2008 R2, for research purposes.

I meanly used the blog post of Steven Murawski Building a Desired State Configuration Pull Server, but there were some point in there that needed clarification. In the walk-through below I will add the extra steps and command snippets, but I will keep most settings default.

So I split the installation of the DSC Pull Server into 2 phases, Installation and Configuration:

Installation

Step 1) Deploy a Windows 2012 R2 Standard server (in my case a VM with 1 CPU and 2GB of memory)

Step 2) Join domain, set a static IP, and run every Windows Update

Step 3) Install Windows Management Framework 4.0 (Download@MS) and reboot

Step 4) Install DSC-Services: Start PowerShell (as Administrator) and use command below:

Add-WindowsFeature Dsc-Service

Step 5) Enable IIS Manager using the command below:

Get-WindowsFeature|where{$_.name -eq "Web-Mgmt-Tools"} | Add-WindowsFeature

Configuration

Step 1) Create directories:

New-Item C:\inetpub\wwwroot\PSDSCPullServer -type directory
New-Item C:\inetpub\wwwroot\PSDSCPullServer\bin -type directory

Step 2) Copy files:

$DefDSC = “C:\Windows\System32\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\PullServer”
Copy-Item $DefDSC\Global.asax C:\inetpub\wwwroot\PSDSCPullServer
Copy-Item $DefDSC\PSDSCPullServer.mof C:\inetpub\wwwroot\PSDSCPullServer
Copy-Item $DefDSC\PSDSCPullServer.svc C:\inetpub\wwwroot\PSDSCPullServer
Copy-Item $DefDSC\PSDSCPullServer.xml C:\inetpub\wwwroot\PSDSCPullServer
Copy-Item $DefDSC\PSDSCPullServer.config C:\inetpub\wwwroot\PSDSCPullServer\web.config
Copy-Item $DefDSC\Microsoft.Powershell.DesiredStateConfiguration.Service.dll C:\inetpub\wwwroot\PSDSCPullServer\bin
Copy-Item $DefDSC\Devices.mdb $env:programfiles\WindowsPowerShell\DscService

Step 3) Open the IIS Manager and create Application pool that runs under the “LocalSystem” account:

PSDSC-AppPool

Step 4) Open the IIS Manager and create a new site or reuse the default site (as I did), point the root of the site to the PSDSCPullServer and change the Application Pool to the pool and directory we created earlier:

PSDSC-IISconf

Step 5) Unlock the sections of the web config as below:

$appcmd = "$env:windir\system32\inetsrv\appcmd.exe"
& $appCmd unlock config -section:access
& $appCmd unlock config -section:anonymousAuthentication
& $appCmd unlock config -section:basicAuthentication
& $appCmd unlock config -section:windowsAuthentication

Step 6) Update the web.config we copied earlier, put the code in the “appSettings”:

<add key="dbprovider" value="System.Data.OleDb" />
<add key="dbconnectionstr" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\WindowsPowerShell\DscService\Devices.mdb;" />
<add key="ConfigurationPath" value="C:\Program Files\WindowsPowerShell\DscService\Configuration" />
<add key="ModulePath" value="C:\Program Files\WindowsPowerShell\DscService\Modules" />

 

Now Test

If you navigate to http://localhost/psdscpullserver.svc you will see something like below:

PSDSC-WEB

Now the configuration of the PowerShell Desired Configuration Pull Server is done and you can proceed with creation of the Configurations.

Also see my earlier post on Getting started with Windows PowerShell Desired State Configuration – Part 1

 

Other Links I can recommend:

http://readsource.co.uk/blog/2013/10/1/configuring-powershell-dsc-pull-mode

http://blog.cosmoskey.com/powershell/desired-state-configuration-in-pull-mode-over-smb/

http://shellyourexperience.com/2013/09/12/powershell-v4-desired-state-configuration-my-precio-ops-desired/

One Reply to “[PowerShell] Getting started with Windows PowerShell Desired State Configuration – Part 2 – Pull Server”

Leave a Reply

Your email address will not be published. Required fields are marked *