How to retrieve DSC LCM Meta Configuration Properties – Part 1

Local Configuration Manager is heart and mind of DSC. It runs on every node and is responsible for executing almost all the functions provided by DSC. LCM provides APIs that are used by DSC for

1. Retrieving LCM Meta Configuration properties
2. Setting LCM Meta Configuration properties
3. Retrieving the current configuration
4. Testing the current configuration
5. Rolling back the current configuration
6. Testing and re-applying the current configuration
7. Stopping a running configuration
8. Just sending configuration to target node
9. Just applying configuration on to the target node
10. sending and applying configuration to the target node.

This blog is first entry in a 10 part series for understanding LCM and its execution. In each step, We will look at one function provided by LCM.

There are multiple ways to invoke DSC LCM APIS.In all the posts, we will show three different ways to use the DSC LCM functionality mentioned above. They are

1. WMI
2. CIM
3. DSC cmdlet(if such exists)

In this post, we will look at “How to retrieve DCS LCM Meta Configuration Properties”.

Using DSC cmdlet

DSC module provides cmdlet named Get-DSCLocalConfigurationManager. Running this command without any parameter will run the command on local computer and return its properties of LCM Meta Configuration.

PS C:\WINDOWS\system32> Get-DscLocalConfigurationManager

We can also run this command with CIMSession as argument to return the properties of a remote target mode. In this case, we are returning the LCM properties of SQL01 computer.

PS C:\WINDOWS\system32> $Session = New-CimSession -ComputerName “SQL01”
PS C:\WINDOWS\system32> Get-DscLocalConfigurationManager -CimSession $Session

The output would look like below. The result could be different in your’s machine. Below figure Shows the default LCM meta configuration on a newly created Windows Server 2012 R2 machine.

LCM-01-01

Windows Management Instrumentation (WMI)

We can also use WMI Cmdlets to read the properties of the DSC LCM Meta configuration. we will be invoking a WMI method named “GetMetaConfiguration” on class “MSFT_DSCLocalConfigurationManager” available in WMI namespace “ROOT\Microsoft\Windows\DesiredConfigurationManager”. The method returns an object having “MetaConfiguration” as property containing all the properties related to LCM meta configuration.

LCM-01-02

Common Information Model (CIM)

This method is very similar to the WMI method but it uses the CIM cmdlets for reading the properties of the DSC LCM Meta Configuration. We learned the basics of CIM in chapter 1 and using the same knowledge we can see in Image 3 that we are invoking a CIM method named “GetMetaConfiguration” on class “MSFT_DSCLocalConfigurationManager” available in WMI namespace “ROOT\Microsoft\Windows\DesiredConfigurationManager”. The method returns an object having “MetaConfiguration” as property containing all the properties related to LCM meta configuration.

LCM-01-03

Hope you enjoyed this post!

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