PowerTip: Use PowerShell to Find Virtual Hard Disks

Doctor Scripto

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


Discussion is closed.

Feedback usabilla icon