LCM Enumerations in WMF 5.0 February preview release

 

Local Configuration manager in WMF 5.0 February preview release has introduced newer properties along with additional configuration values.

Below are updated and latest configuration values for some of its properties.

 

RefreshMode

“Push” and “Pull” had been the applicable values for RefreshMode property since beginning. Now an additional “Disabled” has been added to disable local configuration manager to not apply configuration to a target Node

 

ConfigurationMode

There is no change in the ConfigurationMode property. The applicable value are same as in previous version – “ApplyOnly”, “ApplyAndMonitor” and “ApplyandAutoCorrect”.

 

ActionAfterReboot

This is a new property that determines the action Local configuration manager should undertake after a target node restarts as a result of applying a configuration. The applicable values are “ContinueConfiguration” and “StopConfiguration”

 

DebugMode

DebugMode has added newer set of values. Earlier DebugMode used to accept boolean values – either “true” or “false” determining if the resource modules should be cached or not. It has gone complete change and now it accepts four different values instead of boolean true or false.

None” signifies that DebugMode is False and not applicable.

ForceModuleImport” enforce the resource module to be reloaded instead of using the cache. This is similar to “true” value in previous versions.

ResourceScriptBrealAll” helps in debugging DSC resources when Local configuration manager tries to execute their functions. More on it in subsequent blog posts!

All” signifies that debugging as well as reloading of modules are both enabled.

 

LCMState

LCMState determines the current state of LCM, whether it is busy executing and applying configurations or is waiting for a node reboot to happen or doing nothing. Each of these three states are represented through three different values. “Busy” while LCM is working on the target node, “PendingReboot” while LCM is waiting for node to restart and “Ready” when LCM is doing nothing. It could be waiting for commands to apply configurations or pull configuration or reapply apply configuration.

We will delve deeper into these configurations in subsequent blog posts!

Stay tuned!

Cheers!!

Advertisements

Local Configuration Manager (LCM) in Powershell Desired State Configuration (DSC) in WMF 5.0

Local Configuration Manager (LCM) for Powershell Desired State Configuration (DSC) in WMF 5.0

Local Configuration Manager is coming off a long way and I personally think it still has a long way to go. However, with its latest and current February 2015 release there are many new interesting features compared to its earlier preview release. Infact, many of the features featuring in November 2014 release have now stabled.

The following command can be executed on each of the DSC versions to view the Local Configuration Manager settings available.

v0L

Following will be results in different WMF versions

In WMF 4.0 version, following commands were available

v1L

In WMF 5.0 version of November 2014 release, the commands were

v2L

And in its February 2015 preview release, they are

v3L

You can see that the features and functionalities provided are ever increasing to DSC Local Configuration Manager and making it a really powershell agent for Configuration and deployment management.

We will deep-dive into each of these properties to know how they work and impact the configurations and their execution.

Stay tuned!!

Cheers to DSC !!

How to Stop Configuration at target Nodes – part 10

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”.

LCM-10-01

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

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

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

LCM-10-04

Hope this Post helps!

Cheers!

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!

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!