Last active
March 29, 2018 09:16
-
-
Save countingpine/8777b7db3abe1db352a4f1d98424cf8e to your computer and use it in GitHub Desktop.
Powershell script to get each VM, and list its disks, and list the chain of differencing disks for each one
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Foreach ($VM in Get-VM){ | |
| Write-Output $VM.name | |
| Foreach ($HardDrive in $VM.HardDrives){ | |
| $VHDPath = $HardDrive.path | |
| Do { | |
| Write-Output ("- " + $VHDPath) | |
| $VHDPath = (Get-VHD -Path $VHDPath).ParentPath | |
| } While ($VHDPath) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment