Stop-DscConfiguration

Stops a configuration job that is running.

Syntax

Stop-DscConfiguration
    [-Force]
    [-CimSession <CimSession[]>]
    [-ThrottleLimit <Int32>]
    [-AsJob]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The Stop-DscConfiguration cmdlet stops a configuration job that is running. Specify which computers this cmdlet applies to by using Common Information Model (CIM) sessions. If there's no configuration job running, this cmdlet returns a warning message.

Stop-DscConfiguration is only available as part of the November 2014 update rollup for Windows RT 8.1, Windows 8.1, and Windows Server 2012 R2 from the Microsoft Support library. Before you use this cmdlet, review the information in What's New in Windows PowerShell 5.0

Examples

Example 1: Stop a configuration job

In this example, a CIM session is created using the New-CimSession cmdlet. The CimSession object is used to stop a running configuration job.

$Session = New-CimSession -ComputerName Server01 -Credential ACCOUNTS\User01
Stop-DscConfiguration -CimSession $Session

New-CimSession uses the ComputerName parameter to specify the Server01 computer. The Credential parameter specifies the user account. The CimSession object is stored in the $Session variable. When the command is run, you're prompted for the user account's password.

Stop-DscConfiguration uses the CimSession parameter and the object stored in $Session to stop the configuration job.

Parameters

-AsJob

Indicates that this cmdlet runs the command as a background job. For more information about PowerShell background jobs, see about_Jobs and about_Remote_Jobs.

To use the AsJob parameter, the local and remote computers must be configured for remoting. On Windows Vista and later versions of the Windows operating system, you must open PowerShell with the Run as administrator option. For more information, see about_Remote_Requirements.

Type:SwitchParameter
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-CimSession

Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such as the output from New-CimSession or Get-CimSession.

Type:CimSession[]
Aliases:Session
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Stop-DscConfiguration doesn't support the Confirm parameter. If the Confirm parameter is used, an error is displayed.

For PowerShell cmdlets that support Confirm, using the parameter prompts you for verification before a command is run.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Force

Forces the command to run without asking for user confirmation.

Type:SwitchParameter
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ThrottleLimit

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, PowerShell calculates an optimum throttle limit 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.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet isn't run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

None

Outputs

None