<!-- skill: Windows Power Use | version: 1.0.0 | description: Master PowerShell, Winget, WSL2 and Windows automation | category: System & Productivity -->
## Instructions
- Use PowerShell 7 (pwsh) for all scripting, not CMD or Windows PowerShell 5.1 — install via Winget.
- Install and update apps with Winget: search, install, upgrade --all weekly to kill manual updaters.
- Set ExecutionPolicy to RemoteSigned for current user only, never Unrestricted machine-wide.
- Use Task Scheduler for automation: run backups, scripts, shutdowns with SYSTEM or stored credential tasks.
- Enable WSL2 + Ubuntu for Linux tools: wsl --install, set version 2, use Windows Terminal for tabs.
- Debloat safely: uninstall provisioned apps via Winget/DISM, never delete System32 or run random debloat EXEs.
- Create a restore point before drivers, registry edits, or debloat: Checkpoint-Computer + SystemPropertiesProtection.
- Use Remote Desktop + SSH wisely: RDP on LAN with NLA, SSH via OpenSSH server for headless access.
- Manage startup with Task Manager > Startup + Autoruns; disable anything over high impact you do not need.
- Use PowerToys (FancyZones, PowerRename, Run) to fix window snapping and bulk rename pain.
- Back up with File History + Macrium/Veeam image monthly; test restore yearly or backup does not exist.
- Keep secrets in Credential Manager or 1Password CLI, never plaintext in .ps1 scripts.
## Examples
- Example 1: Weekly update all apps: winget upgrade --all --silent --accept-package-agreements.
- Example 2: Nightly backup task: robocopy D:\Work \\NAS\Backup /MIR /XD node_modules .git at 2am via Scheduler.
- Example 3: Dev setup: wsl --install -d Ubuntu, install Docker Desktop with WSL2 backend, VS Code Remote-WSL.
- Example 4: Debloat laptop: winget uninstall Cortana, TikTok, Clipchamp bloat, then disable background apps.
## Workflows
- Workflow A — New PC setup: 1. Update Windows 2. Install pwsh + Terminal + PowerToys 3. Winget bundle install 4. Restore point 5. WSL2 setup.
- Workflow B — Automate script: 1. Write .ps1 in VS Code 2. Test -WhatIf 3. Sign or RemoteSigned 4. Create Scheduled Task 5. Check History log.
- Workflow C — Safe debloat: 1. Create restore point 2. List provisioned apps 3. Remove per-user only 4. Disable services (not delete) 5. Reboot test.
- Workflow D — Remote access: 1. Enable OpenSSH server 2. Key-only auth 3. Tailscale/WireGuard for WAN 4. Test RDP over VPN, never open 3389.
## Templates
- PowerShell essentials snippet:
```powershell
# Requires PowerShell 7
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
winget upgrade --all --silent
Get-Service | Where-Object Status -eq Running | Sort-Object DisplayName
# Backup with log
robocopy C:\Work D:\Backup\Work /MIR /R:2 /W:5 /LOG:D:\Backup\robocopy.log /XD node_modules .git
Checkpoint-Computer -Description "PreDebloat" -RestorePointType MODIFY_SETTINGS
Get-ScheduledTask | Where-Object State -eq Ready
```
- Winget bundle file (apps.txt):
```
Microsoft.PowerShell
Microsoft.WindowsTerminal
Microsoft.PowerToys
Git.Git
Valve.Steam
VideoLAN.VLC
7zip.7zip
Mozilla.Firefox
```
- Task Scheduler XML pattern: Trigger Daily 02:00, Action pwsh.exe -File C:\Scripts\backup.ps1, Run whether logged on, Wake to run.
## Tools
- Winget — official package manager; winget list, search, install, upgrade --all covers 90% of needs.
- Windows Terminal + PowerShell 7 — tabs, panes, JSON settings, Oh-My-Posh prompt for git status.
- PowerToys — FancyZones layouts, PowerRename regex, Text Extractor OCR, Hosts editor.
- WSL2 + Docker Desktop — Linux kernel in Windows, VS Code Remote-WSL for full Linux dev.
- Autoruns + WizTree — find startup bloat and disk hogs in seconds.
- Tailscale — zero-config VPN for safe RDP/SSH without port forwarding.
## Advanced
- Use Desired State Configuration (DSC v3) or dotfiles repo to make setup reproducible across PCs.
- Script registry tweaks with .reg backups: export key first, apply via reg import, document undo.
- Run Hyper-V sandboxes for untrusted EXEs: Windows Sandbox with mapped folder, discard on close.
- Tune WSL2 .wslconfig memory/CPU limits to stop Docker eating 16GB RAM idle.
- Audit scheduled tasks quarterly: Get-ScheduledTask | Export-CSV, kill updaters phoning home hourly.
- Enable BitLocker + TPM + PIN, store recovery key in Microsoft account and offline USB.
## Documentation
- Microsoft Learn PowerShell 7 docs — cmdlet reference and remoting over SSH guide.
- Winget CLI reference — manifests, --override installer args, private source setup.
- Windows Terminal docs — settings.json schema, keybindings, pane management.
- WSL2 best practices — .wslconfig tuning, systemd enable, GPU/CUDA passthrough notes.
- Sysinternals Suite guide — Autoruns, Process Explorer for malware/startup triage.
