Skip to content

Instantly share code, notes, and snippets.

@gladiopeace
Created January 27, 2024 08:28
Show Gist options
  • Save gladiopeace/68be4f3363c2f1e8cba8fca59e000785 to your computer and use it in GitHub Desktop.
Save gladiopeace/68be4f3363c2f1e8cba8fca59e000785 to your computer and use it in GitHub Desktop.
# Requires running as Administrator
# This is a simplified example and may need modifications to work in your environment
$windowsInstallations = Get-WindowsInstallations # Custom function to detect Windows installations
foreach ($install in $windowsInstallations) {
$description = "Windows on " + $install.DriveLetter
$guid = (bcdedit /copy {current} /d $description).Trim().Split(" ")[2]
bcdedit /set $guid device partition=$install.DriveLetter
bcdedit /set $guid osdevice partition=$install.DriveLetter
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment