Windows Feature Auditor
Think of the Windows Feature Auditor as a "Pre-Flight Checklist" for your operating system. While your first script (System Insights) checks your PC's health (temperature, RAM, storage), this script checks your PCβs identity and potential.
Here is a breakdown of exactly what it does and why itβs important for your workflow.
1. Capability Discovery
Windows is a massive OS, but it ships with many of its most powerful tools "gutted" or hidden to save resources for the average user. The Auditor identifies which of these pro-level engines are currently sitting idle on your drive.
- The Goal: To know if your PC is a "Standard Office PC" or a "Developer Workstation."
2. Environment Verification
For a developer, the "Developer Environment" section is the most critical. It checks for hidden barriers that often cause mysterious bugs later:
- Execution Policy: Ensures Windows won't block the very scripts you are writing.
- Long Paths: Confirms you can download complex projects without Windows crashing because a folder name is too long.
- Developer Mode: Checks if the OS has "unlocked" the ability to use advanced file-linking (Symlinks) used by modern coding tools.
3. The "Pro vs. Home" Reality Check
Windows 11 Home (which you are running) has hard limits. The Auditor tells you exactly where those limits are by marking features as Unsupported.
- Why it matters: It prevents you from wasting hours trying to enable something like "Windows Sandbox" which physically doesn't exist in the Home edition.
What do the Statuses mean?
| Status | Meaning | Action |
|---|---|---|
| Enabled (Green) | The engine is running and ready to use. | None needed. |
| Disabled (Yellow) | You have the feature, but itβs turned off. | Can be fixed with a command/reboot. |
| Unsupported (Red) | Your Windows Edition (Home) lacks this code. | Requires an upgrade to Windows Pro. |
Why we made it a separate script
We separated this from the main "Health" script for two main reasons:
- Performance: Querying the Windows Feature database (DISM) is "heavy" and slow. You don't want to wait for it every time you just want to see your CPU temperature.
- Audit vs. Monitor: You monitor your health daily, but you only audit your capabilities when you're setting up a new project or fixing a configuration issue.
Windows Feature Auditor Code
# Requires -RunAsAdministrator
$OSInfo = Get-CimInstance Win32_OperatingSystem
Write-Host "--- Windows Feature Auditor (2.3) ---" -ForegroundColor Cyan
Write-Host "Edition: $($OSInfo.Caption)" -ForegroundColor Gray
# 1. Define target features
$FeatureMap = [ordered]@{
"Microsoft-Windows-Subsystem-Linux" = "WSL: Runs Linux distros (Ubuntu, etc) natively."
"VirtualMachinePlatform" = "VM Platform: Engine for WSL2 and Android apps."
"Microsoft-Hyper-V|HypervisorPlatform" = "Hyper-V: Professional Virtual Machine engine."
"Windows-Sandbox" = "Sandbox: Isolated Windows desktop for testing."
"Containers" = "Containers: Required for Docker development."
"OpenSSH-Client" = "SSH: Connect to remote servers/GitHub."
}
# 2. Query DISM & Registry
Write-Host "Querying system capabilities..." -ForegroundColor Gray
$AllFeatures = Get-WindowsOptionalFeature -Online
$DevMode = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" -Name "AllowDevelopmentWithoutDevLicense" -ErrorAction SilentlyContinue
$LongPaths = Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -ErrorAction SilentlyContinue
# 3. Process Feature Table
Write-Host "`n[ FEATURE STATUS & DEFINITIONS ]" -ForegroundColor Green
Write-Host "--------------------------------------------------------------------------------"
foreach ($Key in $FeatureMap.Keys) {
$SearchNames = $Key -split '\|'
$Match = $AllFeatures | Where-Object { $SearchNames -contains $_.FeatureName } | Select-Object -First 1
$StatusStr = if ($Match) { "$($Match.State)" } else { "Unsupported" }
$Color = switch($StatusStr) { "Enabled" {"Green"} "Disabled" {"Yellow"} "Unsupported" {"Red"} Default {"Gray"} }
Write-Host " $($SearchNames[0].PadRight(35)) : " -NoNewline
Write-Host "$($StatusStr.PadRight(12))" -ForegroundColor $Color -NoNewline
Write-Host " | $($FeatureMap[$Key])"
}
Write-Host "--------------------------------------------------------------------------------"
# 4. Developer Environment Check (Fixed Logic)
Write-Host "`n[ DEVELOPER ENVIRONMENT ]" -ForegroundColor Green
# Execution Policy
$ExecPol = Get-ExecutionPolicy
$PolColor = if ($ExecPol -eq "Unrestricted" -or $ExecPol -eq "RemoteSigned") { "Green" } else { "Yellow" }
Write-Host " Execution Policy : " -NoNewline; Write-Host "$ExecPol" -ForegroundColor $PolColor
# Developer Mode
$DevStatus = if ($DevMode.AllowDevelopmentWithoutDevLicense -eq 1) { "Enabled" } else { "Disabled" }
$DevColor = if ($DevStatus -eq "Enabled") { "Green" } else { "Yellow" }
Write-Host " Developer Mode : " -NoNewline; Write-Host "$DevStatus" -ForegroundColor $DevColor
# Long Paths
$LPStatus = if ($LongPaths.LongPathsEnabled -eq 1) { "Enabled" } else { "Disabled" }
$LPColor = if ($LPStatus -eq "Enabled") { "Green" } else { "Yellow" }
Write-Host " Long Paths (260+) : " -NoNewline; Write-Host "$LPStatus" -ForegroundColor $LPColor
# 5. WSL Detail Check
if ((Get-Command wsl -ErrorAction SilentlyContinue)) {
Write-Host "`n[ WSL INSTANCE DATA ]" -ForegroundColor Green
$wslData = wsl -l -v 2>$null
if ($wslData) { $wslData | Out-String | Write-Host }
else { Write-Host " WSL is installed but no distributions are found." -ForegroundColor Gray }
}
Write-Host "`n[ ADVICE ]" -ForegroundColor Cyan
if ($OSInfo.Caption -match "Home") {
Write-Host " * Execution Policy is '$ExecPol' - This is good for running scripts."
Write-Host " * To fix 'Disabled' items, we can apply Registry or DISM fixes."
}