How to Rollback Configuration at target Nodes – part 8

This is eight part of 10 series blog on LCM APIs and Internals. In last part, we saw “How to Test Configuration drifts 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 Configuration drifts at target Nodes” using the same three methods.

Till now, we saw sending, applying and testing of configurations on target nodes, however now its time to look at other directions. Once the configuration is send and applied, at time there could be requirement to rollback the configuration. It could be due to various reasons. DSC provides us with the necessary infrastructure to roll back an applied configuration. Rollback of configuration means re-applying the old configuration by replacing the current configuration. In this case, content of Current.mof file and previous.mof files are swapped. After swapping, the configuration in current.mof file is applied on to the target node. There is a DSC cmdlet names Restore-dscconfiguration that rollbacks and apply the old configuration.

Using DSC Cmdlet

Restore-DSCConfiguration cmdlet is used to restore previous configuration as current configuration on a target node. After restoration, the new configuration is also applied on the target node. The execution and syntax is shown here.

LCM-08-01

Windows Management Instrumentation (WMI)

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

LCM-08-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-08-03

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