VM, VHD Questions.

Brass Contributor

Hey Team, 

Doing some studying here creating a new vm using powershell https://docs.microsoft.com/en-us/powershell/module/hyper-v/new-vm?view=win10-ps as well as setting a vm's IOPS settings https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/dn...


Just have a few questions:


1) When you create a new VM using the New-VM Command and adding the -NewVHDPath and the -NewVHDSizeBytes switches, how do you also set the newly created VHD disk type to Dynamic of Fixed? can you do this when running the command or do you have to take 2 separate steps? like using add-vhd ?


2) how do you find the alerts when you set minimum IOPS to say 25 for a VM, if the storage system/Hyper-V cant provide that type of performance, where are those alerts logged? 


This is all for windows 2012 R2. 





2 Replies

Hi Robert,

I took a look at this and the best I could do for a 1 liner is;

New-VM -Name TEST -NoVHD -Generation "2" | Add-VMHardDiskDrive -Path (New-VHD -Path "E:\Hyper-V\Virtual Hard Disks\Test.vhdx" -SizeBytes 25GB -Dynamic).Path -MinimumIOPS "2500"

As for alerts do you have the Microsoft-Windows-Hyper-V-VMMS/Admin log? On 2016 I get event ID 32930, if not set the IOPS value to something unachievable  and check the event viewer 'Administrative Events'




Thanks Steve. I will check for those events as well. Also on the PowerShell command I think after much toiling I came up with something similar to your command.