PowerCLI Reference

Remove-HardDisk

Synopsis

This cmdlet removes the specified virtual hard disks.

Syntax

Remove-HardDisk [-HardDisk] <HardDisk[]> [-DeletePermanently] [-Confirm] [-WhatIf] [<CommonParameters>]

Related Commands

Online Version
Copy-HardDisk
Get-HardDisk
New-HardDisk
Set-HardDisk
Move-HardDisk

Detailed Description

This cmdlet removes the specified virtual hard disks.

Parameters

NameTypeDescriptionRequired?Pipeline InputDefault Value
HardDiskHardDisk[]Specifies the hard disks you want to remove.trueTrue (ByValue)
ConfirmSwitchParameterIf the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation.falseFalse
DeletePermanentlySwitchParameterIndicates that you want to delete the hard disks not only from the inventory, but from the datastore as well.falseFalse
WhatIfSwitchParameterIndicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified.falseFalse

Return Type

None

Notes

Examples

-------------------------- Example 1 --------------------------

Get-HardDisk -VM $vm | Remove-HardDisk

Removes the hard disks of the virtual machine stored in the $vm variable.

-------------------------- Example 2 --------------------------

$hdd = Get-HardDisk -VM 'MyVM' -Name 'Hard disk 4'
Remove-HardDisk -HardDisk $hdd

Removes the 'Hard disk 4' hard disk of the 'MyVM' virtual machine.


Copyright © VMware, Inc. All rights reserved.