Removes a template object from VMM and deletes all files associated with the template.
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
VMTemplate
Required?
true
Accept Pipeline Input?
true (ByValue)
Position?
0
Specifies a VMM template object used to create virtual machines.
Confirm
Required?
false
Accept Pipeline Input?
false
Position?
named
Prompts for confirmation before running the command.
Force
Required?
false
Accept Pipeline Input?
false
Position?
named
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.
JobVariable
Required?
false
Accept Pipeline Input?
false
Position?
named
Specifies that job progress is tracked and stored in the variable named by this parameter.
PROTipID
Required?
false
Accept Pipeline Input?
false
Position?
named
Specifies the ID of the PRO tip that triggered this action. This allows for auditing of PRO tips.
RunAsynchronously
Required?
false
Accept Pipeline Input?
false
Position?
named
Indicates that the job runs asynchronously so that control returns to the command shell immediately.
Requires a VMM template object, which can be retrieved by using the Get-SCVMTemplate cmdlet.
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.
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.