external help file | Module Name | online version | schema |
---|---|---|---|
Hyper-V_Cmdlets.xml |
Hyper-V |
2.0.0 |
Deletes a virtual machine.
Remove-VM [-Name] <String[]> [-AsJob] [-ComputerName <String[]>] [-Force] [-Passthru] [-Confirm] [-WhatIf]
Remove-VM [-VM] <VirtualMachine[]> [-AsJob] [-Force] [-Passthru] [-Confirm] [-WhatIf]
The Remove-VM cmdlet deletes a virtual machine. Running this cmdlet deletes the virtual machine's configuration file, but does not delete any virtual hard drives. If the virtual machine has any snapshots, these are deleted and merged into the virtual hard disk files after the virtual machine is deleted.
PS C:\>Remove-VM "new 1"
ConfirmAre you sure you want to remove virtual machine "new 1"?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y
Removes virtual machine new 1.
PS C:\>Remove-VM -Name "new 2" -Force
Removes virtual machine new 2, suppressing the confirmation prompt.
PS C:\>Get-VM -Name New* | Remove-VM -Force
Removes with no confirmation prompt all virtual machines having names starting with New.
Specifies that this cmdlet is to be run as a background job.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies one or more Hyper-V hosts from which the virtual machine is to be deleted. NetBIOS names, IP addresses, and fully-qualified domain names are allowable. The default is the local computer - use "localhost" or a dot (".") to specify the local computer explicitly.
Type: String[]
Parameter Sets: UNNAMED_PARAMETER_SET_1
Aliases:
Required: False
Position: Named
Default value: .
Accept pipeline input: False
Accept wildcard characters: False
Specifies that confirmation prompts are to be suppressed during deletion of the virtual machine.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies the name of the virtual machine to be deleted.
Type: String[]
Parameter Sets: UNNAMED_PARAMETER_SET_1
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: True
Specifies that an object is to be passed through to the pipeline representing the virtual machine to be deleted.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies the virtual machine to be deleted.
Type: VirtualMachine[]
Parameter Sets: UNNAMED_PARAMETER_SET_2
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Prompts you for confirmation before running the cmdlet.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Default
If -PassThru is specified.