Push

The standard mode of operation that is enabled by default is the push mode. While in push mode, the LCM awaits configuration documents to be pushed to its node. To initiate a push, the Start-DscConfiguration cmdlet can be used. CIM remoting is used to connect to all target nodes, and the configuration document is pushed.

If your configuration documents are larger than WSMAN:localhostMaxEnvelopeSizekb, you will inadvertently run into issues. Try increasing the envelope size in this case.

By default, the configuration is started on a background job and will run entirely on the target nodes. Regardless of the refresh mode, the configuration always follows the same path:

  1. A new configuration document arrives.
  2. Generate a dependency tree and check the resource for incompatible settings.
  3. Check that all used resource modules exist.
  4. For each resource in the dependency tree, first test whether the resource is already in the desired state.
  5. For each failed test, enter a set method in order to correct settings. Otherwise, skip the set method.
  6. Send a configuration apply.

The following simple sample code applies a configuration to your localhost that ensures that a temporary file is always present:

configuration PushComesToShove
{
node localhost
{
File testfile
{
DestinationPath = [System.IO.Path]::GetTempFileName()
Contents = 'We love DSC'
}
}
}

PushComesToShove

# This cmdlet automatically targets all nodes in the sub folder
Start-DscConfiguration .PushComesToShove -Verbose -Wait

# Is the file really created?
Test-DscConfiguration -Detailed

# We can see the current node's configuration as well
Get-DscConfiguration

The first time this configuration is applied, the file will be created and its contents set. For each subsequent push, nothing else will happen:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset