Skip to content

Instantly share code, notes, and snippets.

@jerobado
Created March 24, 2026 23:08
Show Gist options
  • Select an option

  • Save jerobado/0965c2aa9faf73bf66f46d8522fc84f1 to your computer and use it in GitHub Desktop.

Select an option

Save jerobado/0965c2aa9faf73bf66f46d8522fc84f1 to your computer and use it in GitHub Desktop.
How to mount DevDrive using PowerShell in Windows
<#
A script that will mount a DevDrive.
Usage (run as Administrator)
> ./mount-devdrive.ps1
#>
# Check if running as admin
if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
{
Write-Output "Relaunching as administrator..."
Start-Process powershell -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs
exit
}
$devDrivePath = "path/to/your/devdrive.vhdx"
$devDriveDiskImage = Get-DiskImage -ImagePath $devDrivePath
if (-not $devDriveDiskImage.Attached)
{
Write-Output "Mounting $devDrivePath"
Mount-VHD -Path $devDrivePath
Write-Output "Mounted $devDrivePath"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment