Publish-DscConfiguration

Publishes a DSC configuration to a set of computers.
Publish-DscConfiguration [-Path*] <String> [-Force] [-ThrottleLimit [<Int32>]] -CimSession* <CimSession[]>[-Confirm] [-WhatIf] [<CommonParameters>]
Publish-DscConfiguration [-Path*] <String> [[-ComputerName] [<String[]>]] [-Credential [<PSCredential>]] [-Force][-ThrottleLimit [<Int32>]] [-Confirm] [-WhatIf] [<CommonParameters>]

The Publish-DscConfiguration cmdlet publishes a Windows PowerShell Desired State Configuration (DSC) configuration document on set of computers. This cmdlet does not apply the configuration. Configurations are applied by either the Start-DscConfiguration cmdlet when it is used with the UseExisting parameter or when the DSC engine runs its consistency cycle. The DSC engine is also known as the Local Configuration Manager (LCM).

This cmdlet is especially useful when fragments of multiple configuration documents are delivered. When multiple configuration documents fragments are delivered, they overwrite the older configuration document fragments.

Parameters
-CimSession <CimSession[]>

  • This value is required
  • Accepts pipeline input ByValue

Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such as the output of a New-CimSession or Get-CimSession cmdlet. The default is the current session on the local computer.

-ComputerName [<String[]>]

Specifies one or more computers on which this cmdlet publishes the configuration.

-Credential [<PSCredential>]

Specifies credentials that are used to access the target device.

-Force [<SwitchParameter>]

Forces the cmdlet to finish. If the Local Configuration Manager refresh mode is set to PULL, usage of this parameter changes it to PUSH and enables publication of the DSC configuration. Also, if a pending DSC configuration exists, usage of this parameter overwrites that pending configuration.

-Path <String>

  • This value is required

Specifies a path that contains configurations to publish to target computers.

-ThrottleLimit [<Int32>]

Specifies the maximum number of concurrent operations that can be established to run the cmdlet. If this parameter is omitted or a value of 0 is entered, then Windows PowerShellr calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. The throttle limit applies only to the current cmdlet, not to the session or to the computer.

-Confirm [<SwitchParameter>]

  • Default value is false

Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.

-WhatIf [<SwitchParameter>]

  • Default value is false

Shows what would happen if the cmdlet runs. The cmdlet is not run.Shows what would happen if the cmdlet runs. The cmdlet is not run.

<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,ErrorAction, ErrorVariable, WarningAction, WarningVariable,OutBuffer, PipelineVariable, and OutVariable.

Examples
  1. Publish a configuration to a remote computer:
    PS C:> Publish-DscConfiguration -Path '$homeWebServer' -ComputerName "ContosoWebServer" -Credential (get-credential Contosowebadministrator)
    

    This command publishes a configuration to a remote computer. The user who runs the cmdlet should be administrator on the remote computer.

Related Links

Get-DscConfiguration
Get-DscConfigurationStatus
Restore-DscConfiguration
Start-DscConfiguration
Test-DscConfiguration