windows-ops
Helps with
Slow or worsening boot, silently failing drives, crashes with no obvious cause, an HKLM startup entry you can't disable without admin, BSODs that leave no dump, unexplained UAC prompts, 'is it safe to unplug this drive?', cloning a failing drive, no-boot recovery, remote diagnostics, and a hot or out-of-commit machine with no boot-time explanation. Where each signal lives: references/symptom-guide.md.
The Universal Insight
Windows tells you what's wrong if you ask the right log in the right way. Most users (and most tutorials) reach for Task Manager. The actual diagnostic signal lives in the Event Log, the Registry's StartupApproved key, the storage driver's reset events, and the kernel's bugcheck records. This skill packages the queries that turn noise into a verdict.
The most common diagnostic failure: treating symptoms in isolation. "Slow boot" → disable startup apps. "BSOD" → reinstall drivers. "Random crashes" → memtest. These are reasonable last resorts, but the data to identify the actual cause is sitting in the System log untouched. Always audit before treating.
The Diagnostic Ladder
Walk down the layers in order. Each rung has a binary outcome:
0. Is it even local? — a "drive" that is a network mapping belongs to net-ops
1. Hardware errors — WHEA-Logger events (CPU/RAM/PCIe-level faults)
2. Storage health — disk events 7/52/153/154, storahci 129 (controller reset)
3. Crash record — Event 41 (Kernel-Power) + BugCheck code + dump files
4. Pre-crash timeline — events in N minutes before each crash
5. Boot inventory — all 5 startup mechanisms (registry, services, tasks, folders, group policy)
6. Resource pressure — CPU RATE sample, commit hoarders, orphans, stale hosts
7. Verdict — what's failing, what to do
The most interesting failures cluster at rung 2 (storage) and rung 5 (startup bloat). Rung 6 is the most-treated and the most misread: a Task Manager snapshot there really is low-value, which is why it gets waved away — but a CPU rate sample at the same rung finds hung processes no snapshot and no orphan check can see.
Workflow
0. Disambiguate the drive letter first
A user saying "drive Z: is broken" cannot know whether that is a failing physical disk (this skill) or an SMB/name-resolution fault (net-ops) — the drive letter looks identical either way. Settle it before running anything else:
Get-SmbMapping # network mappings + Status (Connected / Disconnected / Unavailable)
Get-PSDrive -PSProvider FileSystem | Where-Object DisplayRoot # non-empty DisplayRoot = UNC-backed
If the letter appears in either result, it is a network mapping — stop here and hand off to net-ops (scripts/windows/smb-audit.ps1). Do not run the physical-disk ladder: disk-health.ps1 and drive-dependencies.ps1 only see local disks, so they will report a clean bill of health on a drive that is genuinely broken, which is worse than reporting nothing.
Everything below assumes a local, physically-attached drive.
1. Run the comprehensive audit
scripts/health-audit.ps1
Produces a verdict block: hardware errors, storage health per disk, recent crashes, top resource consumers, startup inventory. Scan for [FAIL] markers — that's where to drill.
2. Drill into the failing layer
| Symptom | Script |
|---|---|
| Storage errors flagged | scripts/disk-health.ps1 -DiskNumber N (or -DriveLetter X or -Model 'HGST') — focused per-drive deep dive: SMART, all event IDs, controller resets attributable to the drive, verdict |
| Recent crash | scripts/crash-triage.ps1 -CrashTime <datetime> (or omit for most recent) — pre-crash timeline + BugCheck decode with smoking-gun detection |
| "Is it safe to disconnect drive X?" | scripts/drive-dependencies.ps1 -DriveLetter X — finds pagefile, search index, scheduled tasks, services, symlinks, startup shortcuts, run-key refs pointing at drive |
| "Why is boot taking so long?" | scripts/boot-perf.ps1 — per-boot durations from Diagnostics-Performance log (admin) or kernel-event fallback (non-admin), with slow-component flags |
3. Apply the minimum reversible fix
| Action | Script |
|---|---|
| Disable startup app — Run keys (HKCU + HKLM + WOW64) | scripts/safe-disable-startup.ps1 -Name <pattern> (wildcards; HKCU entries need no admin, HKLM entries need an elevated shell, else exit 5 and nothing written) |
| Disable startup folder shortcut | scripts/safe-disable-startup.ps1 -Name '*.lnk' (same script, StartupFolder variant; the all-users folder needs elevation) |
| List current state of all startup entries | scripts/safe-disable-startup.ps1 -List |
| Re-enable previously disabled | scripts/safe-disable-startup.ps1 -Name <pattern> -Enable |
| Set service to Manual (admin) | Set-Service <name> -StartupType Manual; Stop-Service <name> |
| Disable scheduled task | Disable-ScheduledTask -TaskName <name> |
| Copy a folder tree, never stopping on errors | scripts/copy-tree.ps1 <src> <dst> — additive, one retry per file, readable failed-files log; exit 10 = some files failed |
| Safe clone from failing drive | scripts/copy-tree.ps1 <src> <dst> -Mode Rescue — robocopy with /R:0 /W:0 /MT:1 so retries do not pound bad sectors |
| Mirror a folder (DELETES extras at destination) | scripts/copy-tree.ps1 <src> <dst> -Mode Mirror — prompts unless -Force |
| Drive too damaged for file-level copy | scripts/rescue-image.ps1 -ListDevices then -Device <dev> -Image <path> — ddrescue, supervised, resumable via mapfile |
| Get files back out of a rescue image | scripts/extract-image.ps1 -Image <img> -Plan then -Extract -Dest <dir> -Include <pat> — 7-Zip, read-only, no mount needed |
All disables are reversible — the StartupApproved registry mechanism flips one byte; re-enabling is the inverse.
Storage Health & Failure Detection
The single highest-yield audit. Failing drives cause slow boots (Windows times out probing them), instability (controller resets cascade into kernel hangs), and crashes (I/O failures kill critical processes). Three independent data sources to cross-reference:
Disk Events 7 (bad block) and 154 (hardware error) are the high-severity IDs: even 10 in a month is a strong failure signal, hundreds means replace now. storahci Event 129 (controller reset): healthy is zero, more than 5 a month is active failure. \Device\HarddiskN is Get-Disk number N. scripts/disk-health.ps1 runs all three; the manual queries, event catalogue and SMART fallbacks: references/manual-queries.md.
Boot Performance & Startup Management
Windows has five separate startup mechanisms, each requiring different tooling. Task Manager only shows two of them. Full inventory in references/startup-mechanisms.md.
| Mechanism | Where | How to inspect | How to disable |
|-----------|-------|----------------|----------------|
| Registry Run keys | HKCU/HKLM\...\Run (+ WOW6432) | Get-ItemProperty | StartupApproved binary flag |
| Services | Service Control Manager | Get-Service | Set-Service -StartupType Manual (admin) |
| Scheduled Tasks at logon | Task Scheduler | Get-ScheduledTask | Disable-ScheduledTask |
| Startup folder shortcuts | %APPDATA%\...\Startup\ + AllUsers | Get-ChildItem | StartupApproved flag, or delete the .lnk |
| Group Policy startup scripts | HKLM\...\Policies\Scripts | Group Policy Editor / gpresult | (rare on workstations) |
Task Manager's Disable writes a 12-byte StartupApproved flag in the entry's own hive: HKCU entries under HKCU, HKLM Run, WOW64 Run and all-users Startup-folder entries under HKLM\...\Explorer\StartupApproved (admin). An HKCU flag for an HKLM entry has no evidence behind it, so never write one to get around elevation. First byte: low bit set = disabled (0x03, also 0x01), clear = enabled (0x02, 0x04, 0x06). scripts/safe-disable-startup.ps1 routes and decodes this way. Boot timing lives in the admin-only Diagnostics-Performance log (scripts/boot-perf.ps1 falls back to kernel events): healthy SSD 15–25 s to login, failing storage 60 s and up. Detail: references/manual-queries.md.
Crash Analysis & Dump Triage
Event 41 (Kernel-Power) is the crash record: Properties[0] is the BugCheck code (0x0 = none recorded, so hard power loss or a hang) and a non-zero index 6 means the power button was held. The 10 minutes before it hold the story: storahci 129 → storage cascade, GPU driver warnings → driver hang, WHEA → hardware fault, silence → total hang (scripts/crash-triage.ps1 -CrashTime …). No dumps after crashes → check CrashControl\CrashDumpEnabled and pagefile size. Layout and decoding tables: references/manual-queries.md; stop codes: references/bugcheck-codes.md.
Runaway Process Triage
Steady-state, not boot-time — something is burning the machine right now. The
whole discipline is one correction: measure the rate, not the lineage.
Cumulative CPU tells you what a process has ever done. An orphan scan tells you
whose parent died. Neither finds the expensive case — a stuck process whose
supervisor is alive and well, spinning near a full core and producing nothing.
scripts/process-triage.ps1 # sample all, flag >=20% of a core
scripts/process-triage.ps1 -Name claude,node -Threshold 50 # hunt agent/editor spinners
scripts/process-triage.ps1 -Json | ConvertFrom-Json # machine-readable findings
scripts/process-triage.ps1 -Tree 35736 # what a kill takes, leaves-first
Exit 10 = findings, 0 = clean. Two CPU samples across a window give
percent-of-one-core alongside private commit, age and orphan status. **It never
terminates anything** — -Tree emits an ordered list so the caller acts
deliberately.
The guard that matters. The script resolves this session's own ancestry —
shell → agent host → application — before reporting, and marks every hop
protected=True. Killing any of them ends the session doing the investigation,
so that hop must never be indistinguishable from a candidate. Doing this by hand
means walking your own PID up through ParentProcessId first, before you
look at anything else.
Then terminate leaves-first: deepest descendants before their supervisor, so
a live parent cannot respawn a child you already reaped. Later entries reporting
"already gone" is the cascade working, not an error. Killing a process never
deletes files — uncommitted work in its directory survives untouched.
Report commit, not RAM. Windows exhausts commit (RAM + pagefile guarantees,
Win32_OperatingSystem.FreeVirtualMemory) before it exhausts physical memory, so
a box with free RAM can still refuse to start anything. Quote before/after for
process count, private commit, and machine commit free — freeing commit often
recovers more than the sum of what you killed.
Depth — the three failure classes, the triage ladder, Electron/agent-host
topology, stale-build detection, and the worktree-teardown case — is in