Windows – Cannot mount an ISO image file with PowerShell

powershellwindowswindows 10

PS F:\ISOs\System>  [System.Environment]::OSVersion.Version



Major  Minor  Build  Revision
-----  -----  -----  --------
10     0      14393  0

PS F:\ISOs\System> dir


Directory: F:\ISOs\System


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
...
-a----        11/1/2013     13:32      134971392 Win7PE2.iso
...

PS F:\ISOs\System> Mount-DiskImage -ImagePath .\Win7PE2.iso -Verbose
Mount-DiskImage : The system cannot find the file specified.
At line:1 char:1
+ Mount-DiskImage -ImagePath .\Win7PE2.iso -Verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (MSFT_DiskImage:ROOT/Microsoft/.../MSFT_DiskImage) [Mount-DiskImage], CimException
+ FullyQualifiedErrorId : HRESULT 0x80070002,Mount-DiskImage

How to solve this problem?

Best Answer

You need to specify the full path to the .ISO file.

e.g.:

Mount-DiskImage -ImagePath 'F:\ISOs\System\Win7PE2.iso' -Verbose

From Microsoft's Mount-DiskImage TechNet entry, and from Get-Help Mount-DiskImage within PowerShell:

This cmdlet requires the full path of the VHD or ISO file.