Remove-SCVMTemplate
Applies To: System Center 2012 - Virtual Machine Manager
Remove-SCVMTemplate
Removes a template object from VMM and deletes all files associated with the template.
Syntax
Parameter Set: Default
Remove-SCVMTemplate [-VMTemplate] <Template> [-Force] [-JobVariable <String> ] [-PROTipID <Guid> ] [-RunAsynchronously] [ <CommonParameters>]
Detailed Description
The Remove-SCVMTemplate cmdlet removes a template object from the System Center Virtual Machine Manager (VMM) library and deletes all files associated with the template.
The types of files that can be associated with a template include virtual hard disk files (Windows-based .vhd files, Citrix XenServer-based .vhd files, or VMware-based .vmdk files), virtual floppy disk files (Windows-based .vfd files or VMware-based .flp files), and script files (Windows PowerShell .ps1 script files or answer file scripts, including Sysprep.inf and Unattend.xml files).
This cmdlet returns the object upon success (with the property MarkedForDeletion set to TRUE) or returns an error message upon failure.
For more information about Remove-SCVMTemplate, type: "Get-Help Remove-SCVMTemplate -online".
Parameters
-Force
Forces the operation to complete.
For example:
- Remove-SCSCVMHost -Force
Forces the removal of a host object from the VMM database.
- Stop-SCVirtualMachine -Force
Stops a virtual machine.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue) |
Accept Wildcard Characters? |
false |
-JobVariable<String>
Specifies that job progress is tracked and stored in the variable named by this parameter.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-PROTipID<Guid>
Specifies the ID of the PRO tip that triggered this action. This allows for auditing of PRO tips.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-RunAsynchronously
Indicates that the job runs asynchronously so that control returns to the command shell immediately.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-VMTemplate<Template>
Specifies a VMM template object used to create virtual machines.
Aliases |
none |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue) |
Accept Wildcard Characters? |
false |
<CommonParameters>
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters.
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.
- SCVMTemplate
Notes
- Requires a VMM template object, which can be retrieved by using the Get-SCVMTemplate cmdlet.
Examples
1: Remove a specific template from the library.
The first command gets the template object named Template01 from the library on VMMServer01 and stores the object in the $Template variable.
The second command removes the template object stored in $Template from the library.
PS C:\> $Template = Get-SCVMTemplate -VMMServer "VMMServer1.Contoso.com" | where { $_.Name -eq "Template01" }
PS C:\> Remove-SCVMTemplate -VMTemplate $Template
2: Remove all templates from the library.
The first command gets all the template objects from VMMServer01 and stores the objects in the array named $Templates.
The second command passes each template object in $Templates to the Remove-SCVMTemplate cmdlet, which removes each template object from the VMM library. The Confirm parameter prompts you to confirm whether you want to delete each template.
PS C:\> $Templates = Get-SCVMTemplate -VMMServer "VMMServer01.Contoso.com"
PS C:\> $Templates | Remove-SCVMTemplate -Confirm