PowerTip: Use PowerShell to Add Drive to Virtual Machine

Summary: Use Windows PowerShell to add a new hard disk drive to a virtual machine on Hyper-V.

Hey, Scripting Guy! Question How can I to add another hard drive to my virtual machine?

Hey, Scripting Guy! Answer Use the Add-VMHardDiskDrive cmdlet with the following command:

STOP-VM -vmname “My Virtual Machine”

NEW-VHD -Dynamic C:\VHD\MyDrive.vhdx -SizeBytes 60GB

ADD-VMHardDiskDrive -vmname “My Virtual Machine” -path C:\VHD\MyDrive.VHDX

START-VM -vmname “My Virtual Machine”