Skip to content

Instantly share code, notes, and snippets.

@bearlikelion
Created January 15, 2020 18:33
Show Gist options
  • Save bearlikelion/11b8736af11a98c092a7149b4a8ff3b2 to your computer and use it in GitHub Desktop.
Save bearlikelion/11b8736af11a98c092a7149b4a8ff3b2 to your computer and use it in GitHub Desktop.
Get-VMInfo.ps1
# Script is designed to output all Hyper-V Virtual Machine
# Config file location and disks
$VMs = Get-VM
Foreach ($VM in $VMs)
{
Write-Output $VM.Name
Write-Output "---"
Write-Output $VM.ConfigurationLocation
Write-Output $VM.HardDrives.Path
Write-Output ""
}
@bearlikelion
Copy link
Author

Example Output

Machine20-Win2016(TestMachine)
---
C:\ProgramData\Microsoft\Windows\Hyper-V
C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\Machine21_0BED63B8-B131-4333-A7B8-5785B06EDE08.avhdx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment