Troubleshooting PowerShell DSC Deployments.

Troubleshooting PowerShell DSC Deployments.

Troubleshooting PowerShell DSC

Troubleshooting PowerShell DSC – In this post i wanted to share some troubleshooting steps i followed during my DSC testing.

You can read more about my DSC testing i did at my earlier blogpost which shows how to

Automate PowerCLI Install across your Windows Environment using PowerShell DSC

I noticed that during my testing when i ran the Start-DSCConfiguration cmdlet with the below parameters.

Start-DscConfiguration -Wait -Force -Verbose -Path C:\SMB

for some of the executions it worked fine, but for the later part of my testing my ise console was stuck with the below output / error

12489987_1648264852100506_1918447579_o

As you can see in the above screen, my DSC config to generate and apply the MOF files was stuck and there was no output shown after the set of 3 verbose commands.

I referred to some blog posts to clean up the DSC, and was referred to the Remove-DscConfigurationDocument cmdlet.

The Remove-DscConfigurationDocument cmdlet removes a configuration document (.mof file) from the DSC configuration store. During configuration, the Start-DscConfiguration cmdlet copies a .mof file into to a folder on the target computer. This cmdlet removes that configuration document and does additional cleanup.

So i logged into each of my individual vm’s where we need the DSC configurations to be applied and ran the below set of commands, but these too were stuck and did not give any response.

Troubleshooting PowerShell DSC

I waited for quite some time but there was no output.

Finally i was helped out with a post at StackOverflow which suggested to run a Remove-Item cmdlet to clear up the .mof files which also included pending mof files too ( Special Thanks to Steven! ).

Steven is correct. When I run this:

Remove-Item C:\Windows\System32\Configuration\Current.mof, C:\Windows\System32\Configuration\backup.mof, C:\Windows\System32\Configuration\Previous.mof

Now Get-DscConfiguration returns the same error as a clean machine:

Get-DscConfiguration : Current configuration does not exist. Start a DSC configuration first to create a current configuration.

Apart from the above step i also went to the configuration folder of the 3 vm’s and deleted all the mof files and log files except the ones highlighted in blue and rebooted the vm’s.

12509108_1648281582098833_6328534669681795957_n

After performing these steps to clean up DSC configs, i was back on track and the configurations got successful pushed.

Hope this post helps out people who want to troubleshoot DSC Configuration issues.

Share this post

Post Comment