Remove-CMPackage
Remove-CMPackage
Removes a Configuration Manager package.
Syntax
Parameter Set: SearchByIdMandatory
Remove-CMPackage -Id <String[]> [-Force] [-SecuredScopeNames <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]
Parameter Set: SearchByNameMandatory
Remove-CMPackage -Name <String> [-Force] [-SecuredScopeNames <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]
Parameter Set: SearchByValue
Remove-CMPackage -InputObject <IResultObject> [-Force] [-Confirm] [-WhatIf] [ <CommonParameters>]
Detailed Description
The Remove-CMPackage cmdlet removes a package in Microsoft System Center 2012 Configuration Manager. You can delete a package from the site where it was created. System Center 2012 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 2012 Configuration Manager removes it from the database. If the package was sent to child sites, System Center 2012 Configuration Manager removes the package information at those child sites. If a compressed version of source files for the package exists, System Center 2012 Configuration Manager deletes the compressed file from the site server.
Parameters
-Force
Removes the package without prompting you for confirmation. By default, the cmdlet prompts you for confirmation before it proceeds.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
True (ByPropertyName) |
Accept Wildcard Characters? |
false |
-Id<String[]>
Specifies an array of package IDs.
Aliases |
PackageId |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
True (ByPropertyName) |
Accept Wildcard Characters? |
false |
-InputObject<IResultObject>
Specifies a CMPackage object. To obtain a CMPackage object, use the Get-CMPackage cmdlet.
Aliases |
none |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
True (ByPropertyName) |
Accept Wildcard Characters? |
false |
-Name<String>
Specifies an array of package names.
Aliases |
none |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
True (ByPropertyName) |
Accept Wildcard Characters? |
false |
-SecuredScopeNames<String>
Specifies names of security scopes. A security scope name can be Default or the name of a custom-created security scope.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
True (ByPropertyName) |
Accept Wildcard Characters? |
false |
-Confirm
Prompts you for confirmation before running the cmdlet.
Required? |
false |
Position? |
named |
Default Value |
false |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Required? |
false |
Position? |
named |
Default Value |
false |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
<CommonParameters>
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
Outputs
The output type is the type of the objects that the cmdlet emits.
Examples
Example 1: Remove a package
This command removes the package that has the ID CM10000D.
PS C:\> Remove-CMPackage -ID "CM10000D"
Example 2: Remove a package by using an object variable
The first command gets the package that has the ID CM10000D and assigns the results to the $Pkg variable.
The second command removes the package stored in the $Pkg variable.
PS C:\> $Pkg = Get-CMPackage -ID "CM10000D"PS C:\>Remove-CMPackage -InputObject $Pkg