Remove-CMPackage

Removes a Configuration Manager package.

Syntax

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

Description

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

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

Note

Run Configuration Manager cmdlets from the Configuration Manager site drive, for example PS XYZ:\>. For more information, see getting started.

Examples

Example 1: Remove a package

PS XYZ:\> 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 XYZ:\> $Pkg = Get-CMPackage -Id "CM10000D"
PS XYZ:\> 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.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

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

-DisableWildcardHandling

This parameter treats wildcard characters as literal character values. You can't combine it with ForceWildcardHandling.

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

-ForceWildcardHandling

This parameter processes wildcard characters and may lead to unexpected behavior (not recommended). You can't combine it with DisableWildcardHandling.

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

-Id

Specifies an array of package IDs.

Type:String
Aliases:PackageId
Position:Named
Default value:None
Required:True
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
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Name

Specifies an array of package names.

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

-WhatIf

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

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

Inputs

Microsoft.ConfigurationManagement.ManagementProvider.IResultObject

Outputs

System.Object