6:19 PM
1

Introduction

Today was a very good day. Together with a companion we discussed the date. Remember remember the fifth of november. In addition we implemented DSC en founded a good relationship with this Configuration Mamagement System. When searching and tweeting about our findings we found out it isn't a good idea to search on Twitter concerning DSC because the information provided was not relevant. In this post I will tell you all the good things and thus we can experience a wonderful adventure with Desired State Configuration. Also a guide to install your own test-lab for DSC.

Used configuration

Both servers are running Windows Server 2012 R2 Standard.

Steps


  • All scripts can be found at the bottom of this post.

First you will need to import the desired state module for powershell (xPSDesiredStateConfiguration). This module you can download over here. You will need to unzip the zip file in %programfiles%\WindowsPowerShell\modules.



Now we are ready to configure our server as "Pull" server. From this server the clients will pull their configuration files. This will be done be using DSC and manually push it to the server you want to be pull server. You can change the port numbers you want but in this tutorial we use "8080" and "9080".

Run this script. Here it will turn "server1.connexus.hq" into a pull server.
Next we will test if our pull server is actually installed. This we can test in 2 ways. The first method is to get the current DSC configuration on "server1.connexus.hq" with the Powershell command Get-DscConfiguration.

Here we can see the configuration is indeed applied to the server.
The next method is to check the web server. This we can test by opening our webbrowser and go to http://server1.connexus.hq:8080/PSDSCPullServer/PSDSCPullServer.svc.


We can access the webserver.
Next we will create a configuration script for "server2.connexus.hq" For example we want to make this a webserver. This configuration will create a MOF file for the server.




Now our configuration file is made we need to copy it to the configuration folder of the pull server. Also we will not use the name "server2.connexus.hq.mof", we will rename the file to a "guid". This is because a client server asks the pull server the configuration file based on the configurationID you enter on the client. This means you can use a single configuration file for multiple servers. Someone created a script for this so it's very easy to do this.


Now we have our configuration file and pull server configured. Now it's time to create our pull client. This is also by manually pushing a configuration to the pull client.


Now "server2.connexus.hq" will grab the configuration from the pull server and apply it.


Troubleshooting

1) The first error I received was "Set-TargetResource functionality with error message: ERR OR: C:\Windows\System32\WindowsPowerShell\v1.0\modules\PSDesiredStateConfiguration\PullServer"

Because my server is configured in Dutch I had to rename the "en" folder to "nl"

2) The next error was I could not use "Import-DSCResource" because I was using clean servers no updates were installed on the server. I found the solution over here. The solution is to install KB2883200. Just install the update and everything will work.

3) My client didn't wanted to pull the configuration. The solution was to manually trigger the client to get it. After that the client automatically checked the pull server every 15 min.


4) Where can I see the log? The event viewer has one!


Scripts

NewPullServer.ps1


ContosoWebsite.ps1


CopyMOF.ps1


SetToPullMode.ps1


Invoke-PullonNode.ps1

1 reacties:

Note: Only a member of this blog may post a comment.