March 25th, 2015

PowerTip: Use PowerShell to Find Virtual Hard Disks

Doctor Scripto
Scripter

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

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.