How to Send Configuration to Nodes – part 4

This is fourth part of 10 series blog on LCM APIs and Internals. In last part, we saw “How to Retrieve DCS Configurations” using three different methods, namely WMI, CIM and DSC Cmdlet.

In this post, we will continue our journey and would see “How to Send Configuration to Nodes” using the same three methods.

Pushing of configuration to target nodes is responsibility of LCM. There is no equivalent DSC cmdlet for sending the configuration. Sending of configuration means just sending the configuration to target node but not applying the configuration. The configuration is send to the target node and saved locally there. This configuration is applied using another method which we will look in subsequent sections.

Windows Management Instrumentation (WMI)

We can use WMI Cmdlets to send Configurations stored with DSC LCM. We can see in Image below that we are invoking a WMI method named “SendConfiguration” on class “MSFT_DSCLocalConfigurationManager” available in WMI namespace “ROOT\Microsoft\Windows\DesiredConfigurationManager”. The method sends the configuration to target node and saves it locally there however it does not apply the configuration.

LCM-04-01

A sample configuration called “SendConfiguration” is created to be send to localhost computer. We will be using this Configuration for rest of this chapter.
MOF file is generated for localhost at “C:\LCM Demos\SendConfiguration” named localhost.mof.
The mof file is loaded and converted into byte array. To send the configuration to target node, invoke-WmiMethod cmdlet with namespace as “root\Microsoft\Windows\DesiredStateConfiguration”, method name as “SendConfiguration”, Class name as “MSFT_DSCLocalconfigurationManager” and argumentlist as bytearray and force as true.

Common Information Model (CIM)

This method is very similar to the WMI method but it uses the CIM cmdlets for sending the Configuration stored by DSC LCM. We can see in Image below that we are invoking a CIM method named “SendConfiguration” on class “MSFT_DSCLocalConfigurationManager” available in CIM namespace “ROOT\Microsoft\Windows\DesiredConfigurationManager”. All the steps remain same with the only different of using a CIM cmdlet instead of WMI cmdlet and also sending parameters as a hashtable.

LCM-04-02

The result of invoking SendConfiguration method of LCM is that it creates a new file named pending.mof at “C:\Windows\System32\Configuration” with the configuration information within it sent earlier as parameter to WMI or CIM cmdlets. This file is used when “applyConfiguration” is invoked subsequently.

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