Reset-DevDefaults
Reset-DevDefaults Code
<a href='/?search=%23Requires' class='obsidian-tag'>#Requires</a> -RunAsAdministrator
Write-Host "--- Reverting Developer Environment to Windows Defaults ---" -ForegroundColor Cyan
# 1. Disable Windows Features (WSL & Virtual Machine Platform)
Write-Host "`n[1/3] Disabling Windows Features..." -ForegroundColor Green
$Features = @("Microsoft-Windows-Subsystem-Linux", "VirtualMachinePlatform")
foreach ($Feature in $Features) {
Write-Host " Checking $Feature..." -NoNewline
$Check = Get-WindowsOptionalFeature -Online -FeatureName $Feature
if ($Check.State -eq "Enabled") {
Write-Host " Disabling..." -ForegroundColor Yellow
Disable-WindowsOptionalFeature -Online -FeatureName $Feature -NoRestart | Out-Null
} else {
Write-Host " Already Disabled." -ForegroundColor Gray
}
}
# 2. Disable Developer Mode
Write-Host "`n[2/3] Disabling Developer Mode..." -ForegroundColor Green
$DevModePath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
if (Test-Path $DevModePath) {
Set-ItemProperty -Path $DevModePath -Name "AllowDevelopmentWithoutDevLicense" -Value 0
Write-Host " ✓ Developer Mode has been restricted." -ForegroundColor Green
}
# 3. Revert Long Path Support (Optional but cleaner for "Stock" feel)
Write-Host "`n[3/3] Reverting File System to Standard Paths..." -ForegroundColor Green
$PathRegistry = "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem"
Set-ItemProperty -Path $PathRegistry -Name "LongPathsEnabled" -Value 0
Write-Host " ✓ 260-character path limit re-engaged." -ForegroundColor Green
# 4. Summary
Write-Host "`n-------------------------------------------------------" -ForegroundColor Cyan
Write-Host "REVERSION COMPLETE" -ForegroundColor Cyan
Write-Host "-------------------------------------------------------"
Write-Host "REBOOT REQUIRED: To fully remove the Virtualization" -ForegroundColor Red
Write-Host "components from memory, you must restart your PC." -ForegroundColor Red
Write-Host "-------------------------------------------------------"
$Restart = Read-Host "Would you like to restart now to finalize? (Y/N)"
if ($Restart -eq "Y") { Restart-Computer }