Remove-CMPackage

Removes a Configuration Manager package.

Syntax

Remove-CMPackage
      -Id <String>
      [-Force]
      [-DisableWildcardHandling]
      [-ForceWildcardHandling]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-CMPackage
      -InputObject <IResultObject>
      [-Force]
      [-DisableWildcardHandling]
      [-ForceWildcardHandling]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-CMPackage
      -Name <String>
      [-Force]
      [-DisableWildcardHandling]
      [-ForceWildcardHandling]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

The Remove-CMPackage cmdlet removes a package in Microsoft System Center Configuration Manager. You can delete a package from the site where it was created. System Center Configuration Manager cannot delete a package from a distribution point if a user has locked a network file.

When you remove a package, System Center Configuration Manager removes it from the database. If the package was sent to child sites, System Center Configuration Manager removes the package information at those child sites. If a compressed version of source files for the package exists, System Center Configuration Manager deletes the compressed file from the site server.

Examples

Example 1: Remove a package

PS C:\> Remove-CMPackage -Id "CM10000D"

This command removes the package that has the ID CM10000D.

Example 2: Remove a package by using an object variable

PS C:\> $Pkg = Get-CMPackage -Id "CM10000D"
PS C:\> Remove-CMPackage -InputObject $Pkg

The first command gets the package that has the ID CM10000D, and then stores the results to the $Pkg variable.

The second command removes the package stored in the $Pkg variable.

Required Parameters

-Id

Specifies an array of package IDs.

Type:String
Aliases:PackageId
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-InputObject

Specifies a CMPackage object. To obtain a CMPackage object, use the Get-CMPackage cmdlet.

Type:IResultObject
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-Name

Specifies an array of package names.

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

Optional Parameters

-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
-DisableWildcardHandling

DisableWildcardHandling treats wildcard characters as literal character values. Cannot be combined with ForceWildcardHandling.

Type:SwitchParameter
Position:Named
Default value:None
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
-ForceWildcardHandling

ForceWildcardHandling processes wildcard characters and may lead to unexpected behavior (not recommended). Cannot be combined with DisableWildcardHandling.

Type:SwitchParameter
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