PowerTip: Use PowerShell to Find Virtual Hard Disks


Summary: Use Windows PowerShell to find virtual hard disks on your system.

Hey, Scripting Guy! Question I notice that my disk space appears to be disappearing at a rapid rate, and I suspect someone is creating
           virtual hard disks (VHDs) and forgetting about them. How can I use Windows PowerShell to find all the
           VHDs on my system?

Hey, Scripting Guy! Answer Use the Get-ChildItem (LSDirgci are aliases), use a filter like *.vhd*, and specify the Recurse switched
           parameter. To simply report on the path to the VHDs, select the FullName parameter. Here is an example:

Get-ChildItem -Path e: -Filter *.vhd* -Recurse -File | select fullname

Comments (1)

  1. Another great post. Thank you.

Skip to main content