PowerShell Logo Small


This is the built-in help made by Microsoft for the command 'Add-VMHardDiskDrive', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.


Adds a hard disk drive to a virtual machine.


Add-VMHardDiskDrive [-VMName] <String[]> [[-ControllerType] <ControllerType>] [[-ControllerNumber] <Int32>] [[-ControllerLocation] <Int32>] [[-Path] <String>]
[-AllowUnverifiedPaths] [-ComputerName <String[]>] [-DiskNumber <UInt32>] [-MaximumIOPS <UInt64>] [-MinimumIOPS <UInt64>] [-Passthru] [-ResourcePoolName <String>]
[-SupportPersistentReservations] [-Confirm] [-WhatIf] [<CommonParameters>]
Add-VMHardDiskDrive [-VMDriveController] <VMDriveController> [[-ControllerLocation] <Int32>] [[-Path] <String>] [-AllowUnverifiedPaths] [-ComputerName <String[]>]
[-DiskNumber <UInt32>] [-MaximumIOPS <UInt64>] [-MinimumIOPS <UInt64>] [-Passthru] [-ResourcePoolName <String>] [-SupportPersistentReservations] [-Confirm] [-WhatIf]
Add-VMHardDiskDrive [-VM] <VirtualMachine[]> [[-ControllerType] <ControllerType>] [[-ControllerNumber] <Int32>] [[-ControllerLocation] <Int32>] [[-Path] <String>]
[-AllowUnverifiedPaths] [-ComputerName <String[]>] [-DiskNumber <UInt32>] [-MaximumIOPS <UInt64>] [-MinimumIOPS <UInt64>] [-Passthru] [-ResourcePoolName <String>]
[-SupportPersistentReservations] [-Confirm] [-WhatIf] [<CommonParameters>]

Search powershellhelp.space


The Add-VMHardDiskDrive cmdlet adds a hard disk drive to a virtual machine.



Online Version: http://go.microsoft.com/fwlink/?LinkId=306810




Example 1

PS C:\>Add-VMHardDiskDrive -VMName Test -Path D:\VHDs\disk1.vhdx

Creates a virtual hard disk using file D:\VHDs\disk1.vhdx on virtual machine Test.

Example 2

PS C:\>Get-VM Test | Add-VMHardDiskDrive –ControllerType SCSI -ControllerNumber 0

Adds a virtual hard disk to SCSI controller number 0 on virtual machine Test.

Example 3

PS C:\>Get-VMScsiController –VMName Test –Number 0 | Add-VMHardDiskDrive –DiskNumber 2

This example gets a SSCI controller on a virtual machine named Test and then adds physical disk 2 to that controller.

Example 4

PS C:\>Get-Disk 2 | Add-VMHardDiskDrive –VMName Test

This example gets physical disk 2 and then adds it to a virtual machine named Test.