# Get-WindowsOptionalFeature -Online shows all Windows features and their states

**Date:** 2025-12-11  
**Tags:** Windows, PowerShell, Automation  
**URL:** https://kelexine.is-a.dev/til/powershell-get-windowsoptionalfeature

---

TIL: Get-WindowsOptionalFeature -Online shows all Windows features and their states. Combine with Enable/Disable-WindowsOptionalFeature to script Windows setup. Perfect for automating dev environment configuration without clicking through Settings.


```powershell
# List all features
Get-WindowsOptionalFeature -Online | Where State -eq Enabled

# Enable WSL
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux -NoRestart
```




---

*This content is available at [kelexine.is-a.dev/til/powershell-get-windowsoptionalfeature](https://kelexine.is-a.dev/til/powershell-get-windowsoptionalfeature)*
