# Set DevOptimized

To be clear: **No, you are not installing Linux yet.**

Think of what we just did as **building the garage**, but the **car (Linux)** hasn't been delivered.

### What will happen when you reboot:

When you restart, Windows will likely show a screen that says **"Working on updates... %"**. This is because we changed boot-level settings. During this time, Windows is:

1. **Loading the Hypervisor:** It’s activating a thin layer of software that allows Windows and another OS (Linux) to share your CPU hardware simultaneously.
2. **Initializing the WSL Kernel:** It prepares the "translator" that lets Linux commands talk to Windows hardware.

### What changes *after* the reboot:

* **Your Start Menu won't look different.** You won't see an "Ubuntu" or "Linux" icon yet.
* **System Resources:** You might see a very tiny increase in background RAM usage (usually negligible) because the virtualization services are now "on standby."
* **The Capability is Live:** You will finally be able to run the command `wsl --install -d Ubuntu`. **That** is the step that actually downloads and installs the Linux operating system.

### Summary of the "Garage" vs "Car" analogy:

* **Before today:** You had no garage. If you tried to buy a "Linux car," it would have stayed in the street and wouldn't start.
* **What we did today:** We built the garage (Virtual Machine Platform) and paved the driveway (WSL Engine).
* **Next step (Optional):** We "order the car" (Install a Linux Distribution like Ubuntu).

If you decide you don't want the "garage" taking up space, that's what the **Undo script** is for. It "demolishes" the garage and puts your "yard" (Windows) back to exactly how it was.

### Set-DevOptimized Code

```PowerShell

#Requires -RunAsAdministrator
Write-Host "--- Initializing Developer Environment Optimization ---" -ForegroundColor Cyan

# 1. Enable Windows Features (WSL & Virtual Machine Platform)
Write-Host "`n[1/3] Enabling 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 "Disabled") {
        Write-Host " Enabling..." -ForegroundColor Yellow
        Enable-WindowsOptionalFeature -Online -FeatureName $Feature -NoRestart | Out-Null
    } else {
        Write-Host " Already Enabled." -ForegroundColor Green
    }
}

# 2. Enable Developer Mode
Write-Host "`n[2/3] Enabling Developer Mode..." -ForegroundColor Green
$DevModePath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
if (-not (Test-Path $DevModePath)) { New-Item -Path $DevModePath -Force | Out-Null }

$CurrentDev = Get-ItemProperty -Path $DevModePath -Name "AllowDevelopmentWithoutDevLicense" -ErrorAction SilentlyContinue
if ($CurrentDev.AllowDevelopmentWithoutDevLicense -ne 1) {
    Set-ItemProperty -Path $DevModePath -Name "AllowDevelopmentWithoutDevLicense" -Value 1
    Write-Host "  ✓ Developer Mode has been unlocked." -ForegroundColor Green
} else {
    Write-Host "  ✓ Developer Mode is already active." -ForegroundColor Gray
}

# 3. Force Enable Long Paths (Registry)
Write-Host "`n[3/3] Optimizing File System for Long Paths..." -ForegroundColor Green
$PathRegistry = "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem"
Set-ItemProperty -Path $PathRegistry -Name "LongPathsEnabled" -Value 1
Write-Host "  ✓ Long Path support (260+ characters) confirmed." -ForegroundColor Green

# 4. Final Summary
Write-Host "`n-------------------------------------------------------" -ForegroundColor Cyan
Write-Host "OPTIMIZATION COMPLETE" -ForegroundColor Cyan
Write-Host "-------------------------------------------------------"
Write-Host "NOTE: A system restart is REQUIRED to finalize the" -ForegroundColor Yellow
Write-Host "Virtual Machine Platform and WSL installation." -ForegroundColor Yellow
Write-Host "-------------------------------------------------------"

$Restart = Read-Host "Would you like to restart now? (Y/N)"
if ($Restart -eq "Y") { Restart-Computer }

```