Created
March 24, 2026 23:08
-
-
Save jerobado/0965c2aa9faf73bf66f46d8522fc84f1 to your computer and use it in GitHub Desktop.
How to mount DevDrive using PowerShell in Windows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <# | |
| 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