Remove-​Dsc​Configuration​Document

Removes a configuration document from the DSC configuration store.

Syntax

Remove-DscConfigurationDocument
      [-AsJob]
      [-CimSession <CimSession[]>]
      [-Confirm]
      [-Force]
      -Stage <Stage>
      [-ThrottleLimit <Int32>]
      [-WhatIf]
      [<CommonParameters>]

Description

The Remove-DscConfigurationDocument cmdlet removes a configuration document (.mof file) from the Windows PowerShell Desired State Configuration (DSC) configuration store. During configuration, the Start-DscConfiguration cmdlet copies a .mof file to a folder on the target computer. This cmdlet removes that configuration document and does additional cleanup.

This cmdlet is available only as part of the November 2014 update rollup for Windows RT 8.1, Windows 8.1, and Windows Server 2012 R2http://support.microsoft.com/en-us/kb/3000850 (http://support.microsoft.com/en-us/kb/3000850) from the Microsoft Support library. Before you use this cmdlet, review the information in What's New in Windows PowerShellhttp://technet.microsoft.com/library/hh857339.aspx (http://technet.microsoft.com/library/hh857339.aspx) in the TechNet library.

Examples

Example 1: Remove the current configuration document

PS C:\> $Session = New-CimSession -ComputerName "Server01" -Credential ACCOUNTS\PattiFuller
PS C:\> Remove-DscConfigurationDocument -Stage Current -CimSession $Session

The first command creates a CIM session by using the New-CimSession cmdlet, and then stores the CimSession object in the $Session variable. The command prompts you for a password. For more information, type Get-Help New-CimSession.

The second command removes the current configuration document for the computer specified in the CimSession stored in $Session.

Required Parameters

-Stage

Specifies which configuration document to remove. You can specify multiple documents. The acceptable values for this parameter are:

  • Current. Remove the configuration document that describes the current state of the system.
  • Pending. Remove the configuration document that describes the pending state of the system.
  • Previous. Remove the configuration document that describes the previous state of the system.
Type:Stage
Parameter Sets:Current, Pending, Previous
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Optional Parameters

-AsJob

Indicates that this cmdlet runs the command as a background job.

Type:SwitchParameter
Position:Named
Default value:None
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 of a New-CimSession or Get-CimSession cmdlet.

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

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value: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:None
Accept pipeline input:False
Accept wildcard characters:False
-ThrottleLimit

Specifies the maximum number of concurrent operations that can be established to run the cmdlet.

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

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

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

Inputs

None

Outputs

None