{"id":4822,"date":"2012-10-15T00:01:00","date_gmt":"2012-10-15T00:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2012\/10\/15\/use-powershell-to-mount-iso-files-in-windows-8\/"},"modified":"2012-10-15T00:01:00","modified_gmt":"2012-10-15T00:01:00","slug":"use-powershell-to-mount-iso-files-in-windows-8","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/use-powershell-to-mount-iso-files-in-windows-8\/","title":{"rendered":"Use PowerShell to Mount ISO Files in Windows 8"},"content":{"rendered":"<p><strong>Summary<\/strong>: Microsoft Scripting Guy, Ed Wilson, shows how to use Windows PowerShell 3.0 to&nbsp;mount ISO files in Windows 8.&nbsp;<\/p>\n<p>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&mdash;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&nbsp;3.0 in Windows&nbsp;8 and Windows Server&nbsp;2012, no one knows everything. Dude, I do not even have the names of all the cmdlets memorized&mdash;there is a lot to learn.<\/p>\n<p>So, the other night at the <a href=\"http:\/\/www.powershellgroup.org\/content\/october-meeting-special-date-october-11-2012\" target=\"_blank\">Windows PowerShell User Group<\/a> 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&mdash;but you will like it!&nbsp;Oh, by the way, the <a href=\"http:\/\/powershellsaturday.com\/003\/speakers\/\" target=\"_blank\">Windows PowerShell Saturday<\/a> event in Atlanta, Georgia, is October 27 (the day after <a href=\"http:\/\/www.microsoft.com\/surface\/en\/us\/default.aspx\" target=\"_blank\">Windows Surface<\/a> 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.<\/p>\n<p>By using Windows PowerShell&nbsp;3.0 in Windows&nbsp;8 and Windows Server&nbsp;2012, the ability to mount an ISO file is built right in. No non-Microsoft utilities are required, nor are complex Win32 APIs involved&mdash;it&rsquo;s all built into the Storage<i> <\/i>module. To use Windows PowerShell to mount an ISO image, all that is required is to call the <b>Mount-DiskImage <\/b>cmdlet and supply a full path to the ISO image.<\/p>\n<p style=\"padding-left: 30px\"><b>Note&nbsp;&nbsp;&nbsp;<\/b>In Windows&nbsp;8, administrative rights are required to mount a VHD, but not to mount an ISO image. In Windows Server&nbsp;2012, admin rights are required to mount both a VHD and an ISO image.<\/p>\n<p>On my computer, I have a folder called <i>Bits <\/i>that contains ISO images for various builds of Windows&nbsp;8, Windows Server&nbsp;2012, and SQL Server&nbsp;2012. I want to mount all of these ISO images at the same time. Here is the command I use.<\/p>\n<p style=\"padding-left: 30px\">PS C:\\bits&gt; dir -Filter *.iso | % {mount-DiskImage -ImagePath $_.fullname}<\/p>\n<p>I pop over to Windows Explorer, and sure enough, all of the ISO images are mounted. This is shown in the image that follows.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/3872.hsg-10-15-12-01.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/3872.hsg-10-15-12-01.png\" alt=\"Image of menu\" title=\"Image of menu\" \/><\/a><\/p>\n<p>I can find out about the mounted drives by using the <b>Get-DiskImage<\/b> cmdlet as shown here.<\/p>\n<p style=\"padding-left: 30px\">PS C:\\bits&gt; dir -Filter *.iso | % {get-DiskImage -ImagePath $_.fullname}<\/p>\n<p style=\"padding-left: 30px\">&nbsp;<\/p>\n<p style=\"padding-left: 30px\">Attached&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : True<\/p>\n<p style=\"padding-left: 30px\">BlockSize&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 0<\/p>\n<p style=\"padding-left: 30px\">DevicePath&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : \\\\.\\CDROM1<\/p>\n<p style=\"padding-left: 30px\">FileSize&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 3490564096<\/p>\n<p style=\"padding-left: 30px\">ImagePath&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : C:\\bits\\9200.16384.WIN8_RTM.120725-1247_X64FRE_ENTERPRISE_EVAL_E<\/p>\n<p style=\"padding-left: 30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; N-US-HRM_CENA_X64FREE_EN-US_DV5.ISO<\/p>\n<p style=\"padding-left: 30px\">LogicalSectorSize : 2048<\/p>\n<p style=\"padding-left: 30px\">Number&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 1<\/p>\n<p style=\"padding-left: 30px\">Size&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 3490564096<\/p>\n<p style=\"padding-left: 30px\">StorageType&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 1<\/p>\n<p style=\"padding-left: 30px\">PSComputerName&nbsp;&nbsp;&nbsp; :<\/p>\n<p style=\"padding-left: 30px\">&lt;output truncated&gt;<\/p>\n<p>I can find volume information about the mounted ISO images by using the <b>Get-Volume<\/b> cmdlet. This is shown here.<\/p>\n<p style=\"padding-left: 30px\">PS C:\\bits&gt; dir -Filter *.iso | % {get-DiskImage -ImagePath $_.fullname} | get-volume<\/p>\n<p style=\"padding-left: 30px\">&nbsp;<\/p>\n<p style=\"padding-left: 30px\">DriveLetter&nbsp; FileSystemL FileSystem&nbsp; DriveType&nbsp;&nbsp; HealthStatu SizeRemaini&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Size<\/p>\n<p style=\"padding-left: 30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; abel&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; s&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ng<\/p>\n<p style=\"padding-left: 30px\">&#8212;&#8212;&#8212;&#8211;&nbsp; &#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;-&nbsp; &#8212;&#8212;&#8212;&nbsp;&nbsp; &#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8211;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;-<\/p>\n<p style=\"padding-left: 30px\">E&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HRM_CENA&#8230; UDF&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CD-ROM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Healthy&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SQLFULL_ENU CDFS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CD-ROM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Healthy&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0 B&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4.2 GB<\/p>\n<p style=\"padding-left: 30px\">J&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HRM_CENA&#8230; UDF&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CD-ROM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Healthy&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0 B&nbsp;&nbsp;&nbsp;&nbsp; 2.38 GB<\/p>\n<p style=\"padding-left: 30px\">K&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HRM_CCSA&#8230; UDF&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CD-ROM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Healthy&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0 B&nbsp;&nbsp;&nbsp;&nbsp; 3.34 GB<\/p>\n<p>If I attempt to find disk information, however, an error arises (unless I am running with administrative rights). This error states, &ldquo;CIM resource was not available,&rdquo; 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.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/6175.hsg-10-15-12-02.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/6175.hsg-10-15-12-02.png\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<p>After I open Windows PowerShell as an administrator, and I attempt to run the command again, I still do not find the disk<i> <\/i>information. I get an &ldquo;object not found&rdquo; error. It appears that mounted ISO drives do not register as physical disk drives, but they do register as disk volumes.<\/p>\n<p>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).<\/p>\n<p style=\"padding-left: 30px\">PS C:\\bits&gt; (dir -Filter *.iso | % {get-DiskImage -ImagePath $_.fullname} |<\/p>\n<p style=\"padding-left: 30px\">Get-Volume).driveletter | % { sl &#8220;$_`:&#8221; ; gci }<\/p>\n<p>To dismount the disks, use the following command.<\/p>\n<p style=\"padding-left: 30px\">dir -Filter *.iso | % {get-DiskImage -ImagePath $_.fullname} | Dismount-DiskImage<\/p>\n<p>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.<\/p>\n<p>I invite you to follow me on <a href=\"http:\/\/bit.ly\/scriptingguystwitter\" target=\"_blank\">Twitter<\/a> and <a href=\"http:\/\/bit.ly\/scriptingguysfacebook\" target=\"_blank\">Facebook<\/a>. If you have any questions, send email to me at <a href=\"mailto:scripter@microsoft.com\" target=\"_blank\">scripter@microsoft.com<\/a>, or post your questions on the <a href=\"http:\/\/bit.ly\/scriptingforum\" target=\"_blank\">Official Scripting Guys Forum<\/a>. See you tomorrow. Until then, peace.<\/p>\n<p><b>Ed Wilson, Microsoft Scripting Guy<\/b><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Microsoft Scripting Guy, Ed Wilson, shows how to use Windows PowerShell 3.0 to&nbsp;mount ISO files in Windows 8.&nbsp; 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 [&hellip;]<\/p>\n","protected":false},"author":596,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[38,362,3,12,367,45,368],"class_list":["post-4822","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-files","tag-powershell-3","tag-scripting-guy","tag-storage","tag-windows-8","tag-windows-powershell","tag-windows-server-2012"],"acf":[],"blog_post_summary":"<p>Summary: Microsoft Scripting Guy, Ed Wilson, shows how to use Windows PowerShell 3.0 to&nbsp;mount ISO files in Windows 8.&nbsp; 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 [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/4822","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=4822"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/4822\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=4822"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=4822"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=4822"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}