PowerShell Logo Small

Add-VMHardDiskDrive



This is the built-in help made by Microsoft for the command 'Add-VMHardDiskDrive', in PowerShell version 3 - as retrieved from Windows version 'Microsoft Windows Server 2012 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.

SYNOPSIS

Adds a hard disk drive to a virtual machine.

SYNTAX


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



Search powershellhelp.space

DESCRIPTION


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



<

RELATED LINKS






REMARKS

<

Examples


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.