Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Multiple MSVM classes query

$
0
0

Hi

I am trying to get a value for a virtual machines disk drives to see if they are dynamic or static. I have worked out that I need to be looking for MSVM_VirtualHardDiskInfo = 3 for dynamic and 2 for static. I have worked out so far how to get the vm to pass its hyper-v host that it is on and connect by element name but can't work out how to add the extra command for the MSVM_VirtualHardDiskInfo. I just want the number 2 or 3 passed back. Here is what I have

$vguest = $env:COMPUTERNAME

$vhost = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters").Hostname


$vms = Get-WMIObject -Class Msvm_ComputerSystem -Namespace "root\virtualization" -ComputerName $vhost| where-object {$_.elementname -eq $vguest}

Thanks

J


Viewing all articles
Browse latest Browse all 21975

Trending Articles