February 10th, 2014

PowerTip: Identify Letter of Mounted ISO or VHD File with PowerShell

Doctor Scripto
Scripter

Summary: Use Windows PowerShell to identify the letter of a mounted ISO or VHD file in Windows Server 2012 R2 or Windows 8.1.

Hey, Scripting Guy! Question I know I can mount ISOs and VHD files in Windows 8.1, but is there a way to programmatically know what
          the drive letter is without checking the GUI and playing with DiskPart?

Hey, Scripting Guy! Answer Pipe the output of Get-DiskImage to Get-Volume or Get-Disk and Get-Partition:

For an ISO file:

GET-DISKIMAGE filename.iso | GET-VOLUME

For a VHD file:

GET-DISKIMAGE filename.vhd | GET-DISK | GET-PARTITION

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.