Remove-SCVMTemplate
Remove-SCVMTemplate
Removes a template object from VMM.
Syntax
Parameter Set: Default
Remove-SCVMTemplate [-VMTemplate] <Template> [-Force] [-JobVariable <String> ] [-PROTipID <Guid]> ] [-RunAsynchronously] [-Confirm] [-WhatIf] [ <CommonParameters>]
Detailed Description
The Remove-SCVMTemplate cmdlet removes a template object from the Virtual Machine Manager (VMM) library. Removing a template object does not delete any virtual hard disks 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.
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? |
false |
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 |
Template |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
True (ByValue) |
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.
- SCVMTemplate
Notes
- This cmdlet requires a Virtual Machine Manager (VMM) template object, which can be retrieved by using the Get-SCVMTemplate cmdlet.
Examples
Example 1: Remove a specific template from the library
The first command gets the template object named Template01 from the library on VMMServer01, and then 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
Example 2: Remove all templates from the library
The first command gets all the template objects from VMMServer01, and then stores the objects in the array named $Templates.
The second command passes each template object in $Templates to the Remove-SCVMTemplate cmdlet by using the pipeline operator. That cmdlet 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