June 14th, 2013

PowerTip: Use PowerShell to Add Drive to Virtual Machine

Doctor Scripto
Scripter

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”

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.