This is tenth and last part of 10 series blog on LCM APIs and Internals. In last part, we saw “How to Test and re-apply 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 Stop Configuration at target Nodes” using the same three methods.
DSC LCM also provides with a method named “StopConfiguration” whose purpose is to stop any configuration that is in process of applying the configuration. There is no equivalent DSC Cmdlet for this method. Also, I have not seen any practical usage of this method since configurations are normally applied within seconds and we can roll back the configuration if the configuration is not acting as intended. It returns a ReturnValue parameter. A value of Zero signifies that either no configuration was in progress or it was able to stop the configuration. Any non zero value signifies an error and the configuration application could not be stopped.
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 “StopConfiguration” on class “MSFT_DSCLocalConfigurationManager” available in WMI namespace “ROOT\Microsoft\Windows\DesiredConfigurationManager”.
The result of executing the above command results the below. The important thing to note that the ReturnValue is Zero meaning success.
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.
The result of executing the above command results the below. The important thing to note that the ReturnValue is Zero meaning success
Hope this Post helps!