Skip to content

Instantly share code, notes, and snippets.

@countingpine
Last active March 29, 2018 09:16
Show Gist options
  • Select an option

  • Save countingpine/8777b7db3abe1db352a4f1d98424cf8e to your computer and use it in GitHub Desktop.

Select an option

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
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