Learning and Sharing
  • Home
  • Blog
  • Linux
  • macOS
  • Virtualization
    • VMware
    • VirtualBox
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
  • Home
  • Blog
  • Linux
  • macOS
  • Virtualization
    • VMware
    • VirtualBox
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
No Result
View All Result

How to Mount and Unmount ISO File in PowerShell

January 30, 2024
in Powershell
0
ADVERTISEMENT

Table of Contents

In this blog post, we will walk through how to mount and unmount ISO file in PowerShell.

Mount ISO file using PowerShell

Mount-DiskImage is PowerShell cmdlet or command to mount ISO file. You need to specify the image path. In this case, we are trying to mount Windows 10 iso file.

Mount-DiskImage -ImagePath "D:\ISOs\windows10.iso"

The result for above command will look like below:

Attached          : True
BlockSize         : 0
DevicePath        : \\.\CDROM0
FileSize          : 4083853312
ImagePath         : D:\ISOs\windows10.iso
LogicalSectorSize : 2048
Number            : 0
Size              : 4083853312
StorageType       : 1
PSComputerName    :

You will see a banner notification at the right bottom corner of your screen:

7gBDyUHRMwlhJ7Gzr8Xg5a1TfkRtRqZe40NLKuZctaS4sQ4LkgU64CCYnR1y

You can also check from Windows Explorer that the disk is mounted.

Fdjs76lsnOHnryg9gU5Zy8As0ud3jbp7hL8DhKdovTtxTudkTtyQWeIXTxiu

In some cases, you want to mount on a remote system. The main way to execute remote commands is with PowerShell remoting using the Enter-PSSession or Invoke-Command cmdlets.

Note: Before you begin, make sure PSRemoting is already enabled in your environment.

$computerName = 'IT-PC02'
Invoke-Command -ComputerName $computerName -ScriptBlock {
   Mount-DiskImage -ImagePath F:\Windows11.iso
}

To get more about the command, you can find help in the following code snippet:

Get-Help Mount-DiskImage

NAME
    Mount-DiskImage
    
SYNOPSIS
    Mounts a previously created disk image (virtual hard disk or ISO), making it appear as a normal disk.
    
    
SYNTAX
    Mount-DiskImage [-ImagePath] <String[]> [-Access {Unknown | ReadWrite | ReadOnly}] [-AsJob] [-CimSession 
    <CimSession[]>] [-Confirm] [-NoDriveLetter] [-PassThru] [-StorageType {Unknown | ISO | VHD | VHDX | VHDSet}] 
    [-ThrottleLimit <Int32>] [-WhatIf] [<CommonParameters>]
    
    Mount-DiskImage [-Access {Unknown | ReadWrite | ReadOnly}] [-AsJob] [-CimSession <CimSession[]>] [-Confirm] 
    -InputObject <CimInstance[]> [-NoDriveLetter] [-PassThru] [-ThrottleLimit <Int32>] [-WhatIf] [<CommonParameters>]
    
    
DESCRIPTION
    The Mount-DiskImage cmdlet mounts a previously created disk image (virtual hard disk or ISO), making it appear as 
    a normal disk. This cmdlet requires the full path of the VHD or ISO file. If the file is already mounted, then the 
    cmdlet will display the following error.
    
    -- `"The process cannot access the file because it is being used by another process."`
    
    To mount a VHD file, administrator privileges is required. Administrator privileges are not needed to mount an ISO 
    file on Windows? 8. On Windows Server? 2012, only an administrator is allowed to mount or eject an ISO file.
    
    To create and mount a VHD on a computer running Hyper-V, use the New-VHD and Mount-VHD cmdlets in the Hyper-V 
    module (which is included in Windows 8 and Windows Server 2012 but not enabled by default). Alternatively, open 
    Disk Management and then choose Create VHD from the Action menu.
    

RELATED LINKS
    Online Version: 
    https://learn.microsoft.com/powershell/module/storage/mount-diskimage?view=windowsserver2022-ps&wt.mc_id=ps-gethelp
    Dismount-DiskImage 
    Get-DiskImage 

REMARKS
    To see the examples, type: "get-help Mount-DiskImage -examples".
    For more information, type: "get-help Mount-DiskImage -detailed".
    For technical information, type: "get-help Mount-DiskImage -full".
    For online help, type: "get-help Mount-DiskImage -online"

Unmount ISO file using PowerShell

The Dismount-DiskImage cmdlet dismounts a disk image (virtual hard disk or ISO) so that it can no longer be accessed as a disk. This cmdlet requires either the full image path of the ISO or VHD file, or the device path.

This example ejects an mounted ISO by specifying the image path at “D:\ISOs\windows10.iso”.

Dismount-DiskImage -ImagePath "D:\ISOs\windows10.iso"
Attached          : False
BlockSize         : 0
DevicePath        :
FileSize          : 4083853312
ImagePath         : D:\ISOs\windows10.iso
LogicalSectorSize : 2048
Number            :
Size              : 4083853312
StorageType       : 1
PSComputerName    :

If you remember the drive letter, you can chain several commands to unmount the iso file. The below command will try to find the image path based on mounted drive-in drive E, then finally unmount it.

Get-Volume -DriveLetter 'E' | Get-DiskImage | Dismount-DiskImage

Conclusion

In conclusion, to mount and unmount ISO files in PowerShell we can use Mount-DiskImage and Dismount-DiskImage cmdlet respectively.

5/5 - (1 vote)
Previous Post

How to Deploy Google Chrome with Intune (Win32 App)

Next Post

Force Password Change without Updating Existing Password in Microsoft 365

Related Posts

Ftr38

How to Get Environment Variable Values Using PowerShell

July 22, 2024
Ftr38

How to Print PATH Environment Variables to The Console in PowerShell

July 25, 2024
Ftr38

How to Create Persistent Environment Variables in Windows

July 26, 2024
Ftr38

How to Get the PATH Environment Variables Using PowerShell

July 25, 2024
Ftr5

How to Set Environment Variable in Windows Using CMD & PowerShell

July 26, 2024
Ftr38

How to Add a Directory to Windows %PATH% Environment Variables

July 23, 2024

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • How To Turn On uBlock Origin Extension in Chrome (2025)
  • Images Hidden Due To Mature Content Settings In CivitAI
  • Azure OpenAI vs Azure AI Hub, How to Choose the Right One for Your Needs

Categories

Stay in Touch

Discord Server

Join the Discord server with the site members for all questions and discussions.

Telegram Community

Jump in Telegram server. Ask questions and discuss everything with the site members.

Youtube Channel

Watch more videos, learning and sharing with Leo ❤❤❤. Sharing to be better.

Newsletter

Join the movement and receive our weekly Tech related newsletter. It’s Free.

General

Microsoft Windows

Microsoft Office

VMware

VirtualBox

Technology

PowerShell

Microsoft 365

Microsoft Teams

Email Servers

Copyright 2025 © All rights Reserved. Design by Leo with ❤

No Result
View All Result
  • Home
  • Linux
  • Intune
  • macOS
  • VMware
  • VirtualBox
  • Powershell
  • Windows 10
  • Windows 11
  • Microsoft 365
  • Microsoft Azure
  • Microsoft Office
  • Active Directory

No Result
View All Result
  • Home
  • Linux
  • Intune
  • macOS
  • VMware
  • VirtualBox
  • Powershell
  • Windows 10
  • Windows 11
  • Microsoft 365
  • Microsoft Azure
  • Microsoft Office
  • Active Directory