/
/

How to Mount or Unmount a VHD/VHDX File as a Drive in Windows 11

by Mauro Mendoza, IT Technical Writer
How to Mount or Unmount a VHD:VHDX File as a Drive in Windows 11 blog banner image

Key Points

  • Mount and unmount VHD/VHDX files in Windows 11 easily using File Explorer, Disk Management, or PowerShell.
  • File Explorer allows quick right-click mounting and ejection for fast access to virtual drives.
  • Disk Management offers advanced options like read-only mounting and manual drive letter assignment.
  • PowerShell enables automated workflows with commands such as Mount-DiskImage and Dismount-DiskImage.
  • Address drive letter conflicts, BitLocker encryption, backup software errors, and bootable disk safety to ensure reliable performance.

If you’ve ever worked with backups, virtual machines, or sandbox environments, you’ve likely encountered a .vhd or .vhdx file. These files behave like physical drives, allowing you to store, access, or restore data efficiently.

Virtual Hard Disks (VHD or VHDX) are disk image file formats that serve the same functions as physical hard drives. They are primarily designed for use with Hyper-V virtual machines. Mounting VHDX files in Windows 11 allows instant access without requiring a permanent setup, such as retrieving important files from a backup.

Why bother? Imagine grabbing a contract from last year’s backup in seconds, validating a script in a sandboxed disk, or keeping your main drive tidy by attaching VHDs only when needed. In this guide, you’ll learn exactly how to mount and unmount these virtual drives via simple clicks or powerful scripts.

Methods for mounting and unmounting VHD/VHDX files as a drive in Windows

These procedures only work for .vhd and .vhdx file types. When following the steps, please ensure that no virtual machine or application is actively using these file types. You’ll also need administrator privileges to configure protected files and use tools like Disk Management, PowerShell, and DiskPart.

Method 1: Mount and unmount via File Explorer

Mounting and unmounting a VHDX file as a drive takes seconds with File Explorer. Here’s how you can do it:

Mounting with File Explorer

  1. Press Win + E or click the folder icon in the taskbar to open File Explorer.
  2. Navigate to and right-click your .vhd or .vhdx file.
  3. Select Mount from the context menu.
  4. You can now access it as a new drive letter (e.g., E:) in File Explorer.

You can now browse, edit, or copy files exactly like a physical drive. You can unmount it at any time by following the steps in the next section.

Unmounting with File Explorer

  1. Open File Explorer (Press Win + E).
  2. Right-click the virtual drive.
  3. Select Eject.

The disk immediately detaches, releasing the drive letter.

Tip: You can add a shortcut to the .vhdx file on your desktop. Double-clicking it will instantly mount the virtual drive — perfect for frequent access.

Method 2: Mount and unmount using Disk Management

If you need more control over doing this task (like read-only files), Disk Management provides the best way for it in Windows 11.

Mount via Disk Management

  1. Press Win + X, then select Disk Management (or press Win + R and type diskmgmt.msc).
  2. Click Action > Attach VHD in the menu bar.
    • Check Read-only if you want to prevent changes (e.g., for backup files).
    • Leave it unchecked if you plan to make changes.
  3. Click OK.

The virtual disk now appears in the volume list, ready to initialize or assign a drive letter.

Unmount via Disk Management

  1. Press Win + X, then select Disk Management (or press Win + R and type diskmgmt.msc).
  2. Right-click the gray disk label (e.g., Disk 2) that represents your attached VHD/VHDX.
  3. Select Detach VHD.

⚠️ ImportantUntick the Delete the virtual disk… checkbox, unless you plan to permanently delete the file.

The virtual disk disappears from Disk Management immediately, freeing up resources.

Method 3: Mount and unmount via PowerShell

Automate mounting and unmounting VHD/VHDX drives with Windows 11 PowerShell.

Mounting a VHD/VHDX file via PowerShell

  1. Press Win + X, then select Terminal (Admin).
    • PowerShell is usually the default command-line tool in Windows Terminal. If not, click the dropdown arrow in the window tabs, then select Windows PowerShell.
  2. Run this command to mount VHD:Mount-DiskImage -ImagePath "your_virtual_drive_path"
  3. Optional: If you want to mount it as read-only, run:Mount-DiskImage -ImagePath "your_virtual_drive_path" -AccessType ReadOnly
  4. Optional: If you want to assign a drive letter to it, run:Get-Partition -DiskNumber (Get-DiskImage -ImagePath "*your_virtual_drive_path*" ).Number | Set-Partition -NewDriveLetter G

Note: For steps 1 and 2, input the path for the VHD file after -Path (e.g., “D:\Backups\Image.vhdx”).

Unmounting a mounted VHD/VHDX drive via PowerShell

  1. Press Win + X, then select Terminal (Admin).
    • PowerShell is usually the default command-line tool in Windows Terminal. If not, click the dropdown arrow in the window tabs, then select Windows PowerShell.
  2. Run this command to dismount VHD cleanly:  Dismount-DiskImage -ImagePath "your_virtual_drive_path"

Key considerations for mounting or unmounting VHD/VHDX drives

Here are some additional considerations to remember when you are mounting or unmounting VHD/VHDX files.

Drive letter conflicts and management

This issue happens because Windows auto-assigns letters (e.g., F:), which can break scripts if that letter is already occupied by another drive.

There are two ways you can fix this:

  • In Disk Management, right-click the partition, then select Change Drive Letter and Paths.
  • Or, in PowerShell, pre-assign letters during mount (do step 4 in mounting via PowerShell).

BitLocker-encrypted VHDs

Take note that mounting doesn’t necessarily mean unlocking it as well. If the disk is encrypted, mount it normally, then right-click the drive > select Unlock BitLocker > enter password.

You can do this via PowerShell by running the following commands:

  • Mount-DiskImage -ImagePath "your_virtual_drive_path"
  • Unlock-BitLocker -MountPoint "input assigned drive letter" -Password (ConvertTo-SecureString "YourPass" -AsPlainText -Force)

Backup/Virtualization Software Conflicts

Mounting VHD/VHDX files will fail with errors like access denied if Hyper-V, Veeam, or Azure Backup is using them. To avoid these errors, shut down VMs in Hyper-V Manager and pause backup jobs in Veeam or Azure. If needed, you can force unlock via PowerShell with Get-Process -File “X:\your.vhdx” \| Stop-Process -Force.

Ensure to always check Hyper-V Manager, then turn off associated VMs. This will help avoid conflicts when mounting a VHD drive used as a backup or in virtualization software.

Bootable VHDs

Mount bootable VHD/VHDX files with extreme caution. Never attempt to mount the currently running system’s boot disk, as it is already in use and will cause critical errors. Instead, only mount offline or copied OS disks.

Mount and unmount VHD/VHDX to keep your Windows system tidy

Mounting and unmounting VHD/VHDX files in Windows 11 transforms virtual disks into Swiss Army knives for IT tasks. Whether rescuing a single file from backups or testing software in isolation, using right-click > Mount for quick access or PowerShell’s Mount-VHD for scripted precision provides an efficient workflow.

Always prioritize safety. Remember only to mount trusted files, eject properly (via Eject or Dismount-VHD), and avoid conflicts with live systems. Treat virtual drives like physical hardware by unmounting cleanly to prevent corruption. By following this guide, you will have an efficient and incorruptible drive for your system.

Quick-Start Guide

NinjaOne offers extensive scripting capabilities that could be used to create a custom script to accomplish this task.

For mounting or unmounting VHD/VHDX files, you would likely need to use PowerShell commands like:

  • Mount-VHD to mount a VHD/VHDX
  • Dismount-VHD to unmount a VHD/VHDX

You could create a custom script in NinjaOne’s Automation Library that leverages these PowerShell commands to mount or unmount VHD/VHDX files.

FAQs

A VHD (Virtual Hard Disk) or VHDX file is a disk image that functions like a physical hard drive. It’s commonly used for virtualization, system backups, and testing environments. Windows 11 allows you to mount these files as virtual drives to access their contents directly.

You can mount a VHD or VHDX file using File Explorer, Disk Management, or PowerShell. The easiest method is to right-click the file in File Explorer and select “Mount,” which instantly attaches it as a new drive.

To unmount, open File Explorer, right-click the virtual drive, and choose “Eject.” Alternatively, use Disk Management’s “Detach VHD” option or PowerShell’s Dismount-DiskImage command for automation.

Mounting may fail if the file is already in use by virtualization or backup software like Hyper-V, Veeam, or Azure Backup. Close related applications, ensure administrator privileges, and verify the file isn’t locked or corrupted before retrying.

Yes, but with caution. BitLocker-encrypted VHDs require you to unlock them after mounting with your password. Never mount an active or bootable system VHD, as doing so can cause system conflicts or data corruption—only mount offline copies instead.

You might also like

Ready to simplify the hardest parts of IT?