Skip to content

Latest commit

 

History

History
195 lines (148 loc) · 3.86 KB

File metadata and controls

195 lines (148 loc) · 3.86 KB
external help file Module Name online version schema
Hyper-V_Cmdlets.xml
Hyper-V
2.0.0

Remove-VM

SYNOPSIS

Deletes a virtual machine.

SYNTAX

UNNAMED_PARAMETER_SET_1

Remove-VM [-Name] <String[]> [-AsJob] [-ComputerName <String[]>] [-Force] [-Passthru] [-Confirm] [-WhatIf]

UNNAMED_PARAMETER_SET_2

Remove-VM [-VM] <VirtualMachine[]> [-AsJob] [-Force] [-Passthru] [-Confirm] [-WhatIf]

DESCRIPTION

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.

EXAMPLES

Example 1

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.

Example 2

PS C:\>Remove-VM -Name "new 2" -Force

Removes virtual machine new 2, suppressing the confirmation prompt.

Example 3

PS C:\>Get-VM -Name New* | Remove-VM -Force

Removes with no confirmation prompt all virtual machines having names starting with New.

PARAMETERS

-AsJob

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

-ComputerName

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

-Force

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

-Name

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

-Passthru

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

-VM

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

-Confirm

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

-WhatIf

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

INPUTS

OUTPUTS

None

Default

Microsoft.Virtualization.Powershell.VirtualMachine

If -PassThru is specified.

NOTES

RELATED LINKS