Use PowerShell to Mount ISO Files in Windows 8

Use PowerShell to Mount ISO Files in Windows 8

  • Comments 10
  • Likes

Summary: Microsoft Scripting Guy, Ed Wilson, shows how to use Windows PowerShell 3.0 to mount ISO files in Windows 8. 

Microsoft Scripting Guy, Ed Wilson, is here. One of the things I love about interacting with the community is that I always come away with something. At times, it is a scenario where an IT Pro is attempting to do something, and the available Windows PowerShell cmdlets do not make the scenario easy. These become great ideas for Hey, Scripting Guy! Blog posts. At other times, I learn something. I do not know everything about everything—no one does. In fact, I consider it to be the mark of a true professional when they admit that they do not know everything about everything. Certainly, in working with Windows PowerShell 3.0 in Windows 8 and Windows Server 2012, no one knows everything. Dude, I do not even have the names of all the cmdlets memorized—there is a lot to learn.

So, the other night at the Windows PowerShell User Group meeting in Charlotte, North Carolina, I hit a trifecta. I picked up a really cool scenario, and I learned two really cool things. The PowerTip and the cmdlets that I talk about today are things I learned about. The scenario? Well, it is a bit more complicated, and I will need to spend some time working on it—but you will like it! Oh, by the way, the Windows PowerShell Saturday event in Atlanta, Georgia, is October 27 (the day after Windows Surface is available). Tickets are still available, and this will be an awesome event. I have seen some of the presentations (at the Windows PowerShell Saturday in Charlotte), and it will be an information-packed day.

By using Windows PowerShell 3.0 in Windows 8 and Windows Server 2012, the ability to mount an ISO file is built right in. No non-Microsoft utilities are required, nor are complex Win32 APIs involved—it’s all built into the Storage module. To use Windows PowerShell to mount an ISO image, all that is required is to call the Mount-DiskImage cmdlet and supply a full path to the ISO image.

Note   In Windows 8, administrative rights are required to mount a VHD, but not to mount an ISO image. In Windows Server 2012, admin rights are required to mount both a VHD and an ISO image.

On my computer, I have a folder called Bits that contains ISO images for various builds of Windows 8, Windows Server 2012, and SQL Server 2012. I want to mount all of these ISO images at the same time. Here is the command I use.

PS C:\bits> dir -Filter *.iso | % {mount-DiskImage -ImagePath $_.fullname}

I pop over to Windows Explorer, and sure enough, all of the ISO images are mounted. This is shown in the image that follows.

Image of menu

I can find out about the mounted drives by using the Get-DiskImage cmdlet as shown here.

PS C:\bits> dir -Filter *.iso | % {get-DiskImage -ImagePath $_.fullname}


Attached          : True

BlockSize         : 0

DevicePath        : \\.\CDROM1

FileSize          : 3490564096

ImagePath         : C:\bits\9200.16384.WIN8_RTM.120725-1247_X64FRE_ENTERPRISE_EVAL_E


LogicalSectorSize : 2048

Number            : 1

Size              : 3490564096

StorageType       : 1

PSComputerName    :

<output truncated>

I can find volume information about the mounted ISO images by using the Get-Volume cmdlet. This is shown here.

PS C:\bits> dir -Filter *.iso | % {get-DiskImage -ImagePath $_.fullname} | get-volume


DriveLetter  FileSystemL FileSystem  DriveType   HealthStatu SizeRemaini        Size

             abel                                s                    ng

-----------  ----------- ----------  ---------   ----------- -----------        ----

E            HRM_CENA... UDF         CD-ROM      Healthy             0 B     3.25 GB

F            HRM_SSS_... UDF         CD-ROM      Healthy             0 B     3.44 GB

G            HRM_SSS_... UDF         CD-ROM      Healthy             0 B     3.44 GB

H            HRM_CENA... UDF         CD-ROM      Healthy             0 B     2.38 GB

I            SQLFULL_ENU CDFS        CD-ROM      Healthy             0 B      4.2 GB

J            HRM_CENA... UDF         CD-ROM      Healthy             0 B     2.38 GB

K            HRM_CCSA... UDF         CD-ROM      Healthy             0 B     3.34 GB

If I attempt to find disk information, however, an error arises (unless I am running with administrative rights). This error states, “CIM resource was not available,” which is somewhat misleading. I need to look in the CategoryInfo portion of the error to see that it was a PermissionDenied error. This is shown in the image that follows.

Image of command output

After I open Windows PowerShell as an administrator, and I attempt to run the command again, I still do not find the disk information. I get an “object not found” error. It appears that mounted ISO drives do not register as physical disk drives, but they do register as disk volumes.

I can get a directory listing from each of the drives by using the following command (the command is broken at the pipe character to permit display on the blog).

PS C:\bits> (dir -Filter *.iso | % {get-DiskImage -ImagePath $_.fullname} |

Get-Volume).driveletter | % { sl "$_`:" ; gci }

To dismount the disks, use the following command.

dir -Filter *.iso | % {get-DiskImage -ImagePath $_.fullname} | Dismount-DiskImage

That is all there is to using the mount and dismount disk image cmdlets. Join me tomorrow when I will talk about more cool Windows PowerShell stuff.

I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, peace.

Ed Wilson, Microsoft Scripting Guy

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • <p>Why do you encrypt your PowerShell Code ?</p> <p> | % { sl &quot;$_`:&quot; ; gci }</p> <p>If you want to do it right use Base64 !</p>

  • <p>Is the Storage module available for Windows 7/2008 R2 for Powershell 3?</p>

  • <p>@Peter Kriegel .... sorry. This is not encrypted, it is using PowerShell aliases. Here is the command syntax spelled out:</p> <p>| Foreach-Object { Set-Location &quot;$_`:&quot; ; Get-ChildItem }</p>

  • <p>@James Bryant not sure. I have not used Windows 7 or Windows Server 2008 R2 in a long time. I would guess that it is not available because it is using a lot of new providers that only exist in Windows 8 and Windows Server 2012 ... but that is only a guess. I do not have access to a Windows 7 or Windows 2008 R2 machine right now to test. </p>

  • <p>Hi, </p> <p>Just have a look to the way I propose to dismount any mounted drives without knowing the source of their ISO file</p> <p><a rel="nofollow" target="_new" href=""></a></p>

  • <p>@James Bryant I&#39;m using PowerShell 3 on Windows 7. No, the Storage cmdlets aren&#39;t available. The API&#39;s to mount images in Windows 7 are also not available. I&#39;ve created a couple wrapper scripts for PowerISO and MagicISO that I&#39;m going to stick on my blog at some point.</p>

  • <p>James Bryant :</p> <p>Function &nbsp; &nbsp; &nbsp; &nbsp;Mount-DiskImage &nbsp; &nbsp; is &nbsp;in &nbsp; Storage module, but powershell 3.0 Lost half module in windows7! </p> <p>powershell 3.0 in windows 7 is Semi-finished products!</p> <p>powershell 3.0 in windows 8 is full version.</p> <p>--------------windows7-------------------</p> <p>c:\Windows\System32\WindowsPowerShell\v1.0\Modules\</p> <p>applocker</p> <p>bitstransfer</p> <p>cimcmdlets</p> <p>ise</p> <p>Microsoft.PowerShell.Diagnostics</p> <p>Microsoft.PowerShell.Host</p> <p>Microsoft.PowerShell.Management</p> <p>Microsoft.PowerShell.Security</p> <p>Microsoft.PowerShell.Utility</p> <p>Microsoft.WSMan.Management</p> <p>PSDiagnostics</p> <p>PSScheduledJob</p> <p>PSWorkflow</p> <p>PSWorkflowUtility</p> <p>TroubleshootingPack</p> <p>--------------windows8-------------------</p> <p>C:\Windows\System32\WindowsPowerShell\v1.0\Modules</p> <p>Appx</p> <p>BitLocker</p> <p>BranchCache</p> <p>CimCmdlets</p> <p>DirectAccessClientComponents</p> <p>Dism</p> <p>DnsClient</p> <p>International</p> <p>iSCSI</p> <p>ISE</p> <p>Kds</p> <p>Microsoft.PowerShell.Diagnostics</p> <p>Microsoft.PowerShell.Host</p> <p>Microsoft.PowerShell.Management</p> <p>Microsoft.PowerShell.Security</p> <p>Microsoft.PowerShell.Utility</p> <p>Microsoft.WSMan.Management</p> <p>MMAgent</p> <p>MsDtc</p> <p>NetAdapter</p> <p>NetConnection</p> <p>NetLbfo</p> <p>NetQos</p> <p>NetSecurity</p> <p>NetSwitchTeam</p> <p>NetTCPIP</p> <p>NetworkConnectivityStatus</p> <p>NetworkTransition</p> <p>PKI</p> <p>PrintManagement</p> <p>PSDiagnostics</p> <p>PSScheduledJob</p> <p>PSWorkflow</p> <p>PSWorkflowUtility</p> <p>ScheduledTasks</p> <p>SecureBoot</p> <p>SmbShare</p> <p>SmbWitness</p> <p>Storage</p> <p>TroubleshootingPack</p> <p>TrustedPlatformModule</p> <p>VpnClient</p> <p>Wdac</p> <p>WebAdministration</p> <p>WindowsDeveloperLicense</p> <p>WindowsErrorReporting</p>

  • Is there a way to edit the ISO to replace files?

  • @Scott This method of mounting an ISO opens it up in a read / write fashion. I use this technique, to add files to an ISO.

  • An easy way to get mounted iso drive letter:<br/><br/>$mountedISO = [string](Mount-DiskImage -ImagePath $_.fullname -Passthru | Get-DiskImage | Get-Volume).DriveLetter + ":\"