How to Test and re-apply Configuration at target Nodes – part 9

This is ninth part of 10 series blog on LCM APIs and Internals. In last part, we saw “How to Rollback Configuration at target Nodes” using three different methods, namely WMI, CIM and DSC Cmdlet.

In this post, we will continue our journey and would see “How to Test and re-apply Configuration at target Nodes” using the same three methods.

There are occasions when you would want to check the configuration drift and having found one would like to reapply the configuration to bring back the target node to its desired configuration state. This can be achieved by combining two of the previous two methods. Testing of Configuration and applying configuration. If we want to achieve the same objective using a single method, DSC provides us with the PerformRequiredConfigurationChecks method. Using this method, you can not only test but also re-apply configuration if there is a drift.

There is no equivalent DSC cmdlet for this function.

Windows Management Instrumentation (WMI)

We can use WMI Cmdlet to test and apply the Configuration. We can see in Image below that we are invoking a WMI method named “PerformRequiredConfigurationChecks” on class “MSFT_DSCLocalConfigurationManager” available in WMI namespace “ROOT\Microsoft\Windows\DesiredConfigurationManager”.

LCM-09-01

The result of executing the above command results the below. The important thing to note that the ReturnValue is Zero meaning success.

LCM-09-02

Common Information Model (CIM)

All the steps remain same with that of WMI however the only difference is using a CIM cmdlet instead of WMI cmdlet and parameters are sent as hashtable.

LCM-09-03

The result of executing the above command results the below. The important thing to note that the ReturnValue is Zero meaning success.

LCM-09-04

Hope this Post helps!

Cheers!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s