PowerTip: Mount ISO or VHD File with PowerShell

Summary: Use Windows PowerShell to mount an ISO or VHD file.

Hey, Scripting Guy! Question I can double-click an ISO file to access it in Windows 8.1, but is there a Windows PowerShell
          cmdlet that will do that for me?

Hey, Scripting Guy! Answer Use the Mount-DiskImage cmdlet and specify the file name:

For an ISO file:


Or for a VHD file:


Comments (7)

  1. @dave No, these Cmdlets do not exist within Server 2008 for either ISO or VHD. You can mount an ISO natively in Server 2012, you can mount a VHD natively in Server 2008 R2. I believe the Cmdlets started to appear in Server 2008 R2. However there ARE options
    for mounting an ISO. Virtual Clone Drive from slysoft.com has worked well for me on Server 2008 in the Past and DOES support Command line options. Within Server 2008 you might be able to use DISKPART to mount a VHD but I don’t have Server 2008 handy to play
    with. Sean

  2. Dave Wolf says:

    Is this supported in Windows 2008 ?

  3. daq says:


  4. AntonyWillis says:

    and how would your powershell script know which drive letter was selected for the mounted ISO/VHD?
    I need to programmatically mount many VHDs (one at a time) and copy out a single folder out of each one

  5. Steve says:

    The following from the scripts in Thomas Lees’ series at
    http://tfl09.blogspot.com/search/label/Virtual%20Labs works for me.
    # Mount the OS ISO image onto the local machine
    Write-Verbose "Mounting ISO image [$Iso]"
    Mount-DiskImage -ImagePath $Iso

    # Get the Volume the Image is mounted to
    Write-Verbose ‘Getting disk image of the ISO’
    $iSOImage = Get-DiskImage -ImagePath $Iso | Get-Volume
    Write-Verbose "Got disk image [$($iSOImage.DriveLetter)]"

    # And get the drive Letter of the dirve where the image is mounted
    # add the drive letter separator (:)
    $iSODrive = "$([string]$iSOImage.DriveLetter):"
    Write-Verbose "OS ISO mounted on drive letter [$iSODrive]"

  6. Abel says:

    How does it know which ISO file is we want to mount.