Quantcast
Channel: TechNet Blogs
Viewing all articles
Browse latest Browse all 17778

PowerTip: Use PowerShell to Add Disks to a Live Virtual Machine

$
0
0

Summary: Use Windows PowerShell to add disks to a live virtual machine on Hyper-V.

Hey, Scripting Guy! Question How can I easily add disk drives to my virtual machine while it is live?

Hey, Scripting Guy! Answer Use the Add-VMScsiController and Add-VMHardDiskDrive cmdlets.

First, stop the virtual machine, add the SCSI controller, then start the virtual machine:

STOP-VM "My Virtual Machine"

ADD-VMScsiController -VMname "My Virtual Machine"

START-VM "My Virtual Machine"

Now attach disks live:

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

ADD-VMHardDiskDrive -vmname "My Virtual Machine" -path C:\VHD\MyDrive.VHDX -ControllerType SCSI

 


Viewing all articles
Browse latest Browse all 17778

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>