Cannot mount an ISO image file with PowerShell

6,660

Solution 1

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.

Solution 2

In case you'd like to use it in a script or you are too lazy to type the full path (as I am), you can go with:

Mount-DiskImage ((Get-Item -Path ".\" -Verbose).FullName+"\ISONAME.iso")
Share:
6,660

Related videos on Youtube

TRX
Author by

TRX

Updated on September 18, 2022

Comments

  • TRX
    TRX over 1 year
    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?

    • Admin
      Admin over 7 years
      What is your question?
    • Admin
      Admin over 7 years
      How to solve this problem? Thanks.
  • TRX
    TRX over 7 years
    Oh my, I don't know why I did not notice this. Thank you very much!
  • flolilo
    flolilo over 6 years
    I don't see the point of this script: why would you use Get-Item and then, later on, specify the ISO's name by yourself? Something along $a = @(Get-ChildItem -Include *.iso) | Select-Item -ExpandProperties FullName; Mount-DiskImage -ImagePath $a[0] -Verbose would seem much more elaborate to me.
  • Asbjørn Ulsberg
    Asbjørn Ulsberg about 6 years
    Thanks! What an incredibly strange restriction and stupid error message, though.