Mounting an ISO assigns it a drive letter so you can browse its contents in File Explorer. ISO files can be mounted using the “Mount” context menu. This article explains how to mount an ISO using PowerShell.
Mount and Dismount ISO Using PowerShell
Suppose you want to mount the ISO file “E:\Windows ISO\Win11_23H2_Enterprise.iso”, open PowerShell and run the following command.
Example 1: Mount an ISO
To mount the ISO, run the following command:
Mount-DiskImage -ImagePath "E:\Windows ISO\Win11_23H2_Enterprise.iso"
Open This PC and see if the ISO is mounted.
Example 2: Mount an ISO and obtain its drive letter
To mount the ISO and get the assigned drive letter, run the following:
Mount-DiskImage -ImagePath "E:\Windows ISO\Win11_23H2_Enterprise.iso" | Get-Volume
Example 3: Mount an ISO and obtain its driver letter and other information
Run the two commands below to mount the ISO and get the drive letter and device information.
$info = Mount-DiskImage -ImagePath "E:\Windows ISO\Win11_23H2_Enterprise.iso" write-output ($info | get-volume) $info
Example 4: Dismount an ISO Using ImagePath
To eject (dismount) an ISO by mentioning the ISO file name, run:
Dismount-DiskImage -ImagePath "E:\Windows ISO\Win11_23H2_Enterprise.iso"
Example 5: Dismount an ISO Using DevicePath
To eject (dismount) an ISO by mentioning the device path, run:
Dismount-DiskImage -DevicePath "\\.\CDROM0"
(In this example, \.\CDROM0 is the device path of the mounted ISO, as shown in the earlier output.)
Example 6: Dismount multiple ISO drive letters pointing to the same ISO
If the same ISO was mounted multiple times using PowerShell, many drive letters would have been assigned. You may wonder how to dismount each ISO drive letter that points to the same image.
For example, if you run the following command, you’ll see the list of ISO drive letters (and CD-ROM drive letters.)
Get-CimInstance Win32_LogicalDisk | ?{ $_.DriveType -eq 5}
As you can see in the above output, there are several ISO drive letters. So, run the Dismount command many times. Or run the Dismount command in the “foreach” loop, as below, so that every ISO drive letter (that points to the same ISO image) is removed.
$numitems = Get-CimInstance Win32_LogicalDisk | ?{ $_.DriveType -eq 5} foreach($item in $numitems){Dismount-DiskImage -ImagePath "E:\Windows ISO\Win11_23H2_Enterprise.iso"}
I hope the information in this article helped.
One small request: If you liked this post, please share this?
One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:- Pin it!
- Share it to your favorite blog + Facebook, Reddit
- Tweet it!