powershell

A 30-line registry audit script that's provably read-only

Write-hosting style, zero Set-* calls — and a structure that lets a reviewer verify safety by grep alone. For teams that need a record, not a refactor.

ProofTune Project··5 min read
PowerShell illustration PowerShell

The discipline

terminal / powershell
param([string] $Out = "$env:USERPROFILE\Desktop\hkcu-audit.txt")

$sections = [ordered]@{
  'Startup entries'    = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Run'
  'Startup approvals'  = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run'
  'Visual performance' = 'HKCU:\Control Panel\Desktop'
  'Taskbar animations' = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced'
}
$report = foreach ($name in $sections.Keys) {
  "## $name"
  (Get-ItemProperty $sections[$name] -ErrorAction SilentlyContinue).PSObject.Properties |
    Where-Object Name -NotLike 'PS*' | ForEach-Object { "{0} = {1}" -f $_.Name, $_.Value }
}
$report | Set-Content $Out -Encoding utf8

What makes it reviewable

  • Literal verbs: only Get-ItemProperty, Set-Content to a chosen output file. No Set-/New-/Remove- anywhere near a hive — a reviewer confirms that by inspection in seconds.
  • Error-bounded: -ErrorAction SilentlyContinue + explicit section headers mean a machine lacking one key still gets the rest of the report.
  • Deterministic order: [ordered] sections produce a diffable file across days — changes gunshot-locate themselves.

Publish the output as part of any bigger audit; nobody needs to trust your intentions when the verbs give you away.

ProofTune ProjectEngineering notes — every claim here names the bytes a real tool touches. Verify first, install second.
ProofTune logo

See these exact settings inside the real tool

The browser replica runs the same strings and states as the installed app — click around before you ever install anything.