LIst all VMs Disk in Hyper-V (VMM)

 Here an easy way to list all your VMs disk. 

This will be useful if need to check what disk has every machine. 

you can then copy the output to excel 


$vms=Get-vm -All

$file="listvms.txt"

for($i=0;$i -lt $vms.count;$i++){foreach($disk in $vms[$i].VirtualHardDisks.sharepath){ $s=$vms[$i].name+";"+$disk; Write-Output $s | Out-File $file -append utf8}}

notepad $file



Be aware that second time, you shuld use a different file, otherwise you will be adding the results to the same file

Comments

Popular posts from this blog

Update DNS static servers in your local Network

Error 'General access denied error' (0x80070005). Starting SCVMM Resource

Powershell Scritp for Inventory VMS in Hyper-V and VMware