Skip to content

Commands

m4bwav edited this page Nov 21, 2026 · 1 revision

tech.py has four commands. Each takes --json. None of them changes the machine.

tech.py net  [--json]
tech.py disk [--json]
tech.py backup [--json] [--target LOCATION ...] [--restore-test FILE [--original FILE]]
tech.py health [--json]

The sample outputs on this page come from tech.py 0.1.1 run with fixture command output for a made-up home network (router 192.168.1.1, Wi-Fi HomeNet) and made-up disks, so they show no real machine. On your PC the values are yours.

Output form

Without --json, each top-level key prints as key: value; a list prints as key: followed by - item lines; nested values print as Python dicts. With --json, the same result prints as indented JSON.

Exit codes

Code When
0 The command ran. Findings, even STOP lines, do not change it.
1 The command is not supported on this system (net and health off Windows).
2 backup --restore-test could not restore the file (0.1.1 and later), or argparse rejected an argument.

net

Walks the ladder Wi-Fi link and signal, router, internet (ping to 1.1.1.1), DNS (resolving example.com). Verdicts: ok, no-link, local-network, isp, dns, degraded. How verdicts are reached has the thresholds.

python scripts/tech.py net

A working connection with a weak signal: the verdict stays ok, the signal adds advice.

verdict: ok
wifi: {'ssid': 'HomeNet', 'radio type': '802.11ax', 'band': '5 GHz', 'channel': '36', 'signal_pct': 31, 'receive rate (mbps)': '864.6', 'transmit rate (mbps)': '720.6'}
gateways:
  - ('Wireless LAN adapter Wi-Fi', '192.168.1.42', '192.168.1.1')
gateway_ping: {'loss_pct': 0.0, 'avg_ms': 3.0}
internet_ping: {'loss_pct': 0.0, 'avg_ms': 3.0}
dns_ok: True
advice:
  - Wi-Fi signal 31% is weak: move closer, lift the router off the floor, or add a wired mesh node; prefer 5/6 GHz near the router, 2.4 GHz for range.

The router answers but the internet does not:

verdict: isp
wifi: {'ssid': 'HomeNet', 'radio type': '802.11ax', 'band': '5 GHz', 'channel': '36', 'signal_pct': 31, 'receive rate (mbps)': '864.6', 'transmit rate (mbps)': '720.6'}
gateways:
  - ('Wireless LAN adapter Wi-Fi', '192.168.1.42', '192.168.1.1')
gateway_ping: {'loss_pct': 0.0, 'avg_ms': 3.0}
internet_ping: {'loss_pct': 100.0, 'avg_ms': None}
dns_ok: True
advice:
  - Router answers but the internet does not: check the modem/ISP box lights and the ISP's outage page before changing settings.
  - Wi-Fi signal 31% is weak: move closer, lift the router off the floor, or add a wired mesh node; prefer 5/6 GHz near the router, 2.4 GHz for range.

net reads netsh wlan show interfaces and ipconfig and parses their English labels; the first adapter with an IPv4 default gateway is the one pinged.

disk

Free space per volume, then each physical disk from Get-PhysicalDisk. Reliability counters (temperature, wear, uncorrected errors, power-on hours) need an administrator shell; without one they print as None and admin_needed says so.

python scripts/tech.py disk
free_space:
  - {'volume': 'C:\\', 'total_gb': 1000, 'free_pct': 7.5}
disks:
  - {'name': 'Example SSD 1TB', 'media': 'SSD', 'health': 'Healthy', 'size_gb': 1000, 'temp_c': None, 'wear_pct': None, 'power_on_h': None, 'uncorrected': 0}
  - {'name': 'Example HDD 4TB', 'media': 'HDD', 'health': 'Warning', 'size_gb': 4001, 'temp_c': None, 'wear_pct': None, 'power_on_h': None, 'uncorrected': 0}
findings:
  - C:\ has 7.5% free: clear space (Storage Sense, Disk Cleanup) before it slows updates.
  - STOP: Example HDD 4TB reports Warning. Back up now, before anything else; then replace the drive.
admin_needed:
  - reliability counters (temperature, wear, errors): rerun as admin

Sizes are in decimal gigabytes (10^9 bytes), as drive makers count. When smartctl is on the PATH, a smartctl line suggests running it as admin for SMART health.

backup

Counts the copies it can see against 3-2-1 (three copies, two kinds of media, one off-site): the original, File History when configured, OneDrive when its folder exists, a Windows system image when wbadmin lists one, and each --target you name. Verdict 3-2-1 met or gaps.

python scripts/tech.py backup
verdict: gaps
copies:
  - {'copy': 'original', 'media': 'this PC', 'offsite': False}
  - {'copy': 'OneDrive (synced folders)', 'media': 'cloud', 'offsite': True}
findings:
  - OneDrive sync is not a true backup: deletions and ransomware sync too. Count it off-site only after checking version history / Recycle Bin restore.
  - Only 2 copies found; 3-2-1 needs 3.
  - No restore tested: run tech.py backup --restore-test <file in backup> --original <same file on PC>. A backup never restored is a hope.
admin_needed:
  - wbadmin system-image versions: rerun as admin

--target

A copy the script cannot see (a USB drive, a NAS, a drive in a drawer, a cloud backup app). Repeat it for each. It is counted as you declare it: the path is not opened or checked, and each target counts as its own kind of media.

--restore-test and --original

--restore-test FILE copies one file out of the backup into a new folder under your temp folder (techwright-restore- plus random letters; it is left there so you can open it) and hashes it with SHA-256. --original FILE is the same file on the PC, compared with the restored copy.

python scripts/tech.py backup --target E:\Backup --restore-test usb/budget.txt --original pc/budget.txt
verdict: 3-2-1 met
copies:
  - {'copy': 'original', 'media': 'this PC', 'offsite': False}
  - {'copy': 'OneDrive (synced folders)', 'media': 'cloud', 'offsite': True}
  - {'copy': 'declared target E:\\Backup', 'media': 'declared:E:\\Backup', 'offsite': False}
findings:
  - OneDrive sync is not a true backup: deletions and ransomware sync too. Count it off-site only after checking version history / Recycle Bin restore.
admin_needed:
  - wbadmin system-image versions: rerun as admin
restore: {'restore_test': 'pass', 'restored_to': '<temp>/techwright-restore-<random>/budget.txt', 'sha256': '301c58f1acad95bf419452a222b9546660a8a122385587362c95c1ed145b151f'}

The restored path is shortened here; yours is a full path. Results: pass, differs (the backup copy is intact but the original has changed since, which is normal for a file you still edit) and fail (the file is not in the backup). A failed restore sets the verdict to restore failed, adds a STOP line first and exits 2:

python scripts/tech.py backup --restore-test usb/nope.txt
verdict: restore failed
copies:
  - {'copy': 'original', 'media': 'this PC', 'offsite': False}
findings:
  - STOP: restore test failed: usb/nope.txt is not a readable file in the backup.
  - Only 1 copy found; 3-2-1 needs 3.
  - All copies sit on one kind of media; add an external drive or cloud.
  - No off-site copy: fire, theft or ransomware takes everything. Add a cloud backup.
admin_needed:
restore: {'restore_test': 'fail', 'reason': 'usb/nope.txt is not a readable file in the backup'}
exit 2

In 0.1.0 the same run printed verdict: gaps and exited 0 (see Versions and upgrading).

The same command with --json, for a file changed since the backup:

python scripts/tech.py backup --json --restore-test usb/budget.txt --original pc/budget.txt
{
  "verdict": "gaps",
  "copies": [
    {
      "copy": "original",
      "media": "this PC",
      "offsite": false
    }
  ],
  "findings": [
    "Only 1 copy found; 3-2-1 needs 3.",
    "All copies sit on one kind of media; add an external drive or cloud.",
    "No off-site copy: fire, theft or ransomware takes everything. Add a cloud backup."
  ],
  "admin_needed": [],
  "restore": {
    "restore_test": "differs",
    "restored_to": "<temp>/techwright-restore-<random>/budget.txt",
    "sha256": "301c58f1acad95bf419452a222b9546660a8a122385587362c95c1ed145b151f",
    "reason": "restored file differs from the current original (changed since the backup?)"
  }
}

health

The ten most frequent critical and error events in the System log over the last seven days, a plain meaning for the ones it knows, Defender's state, and what to check next. A battery adds the powercfg /batteryreport step; winget on the PATH adds winget upgrade.

python scripts/tech.py health
last_boot: 2026-11-20T08:00:00.0000000-06:00
top_errors_7d:
  - {'key': 'Microsoft-Windows-Kernel-Power, 41', 'Count': 3}
  - {'key': 'Microsoft-Windows-WindowsUpdateClient, 20', 'Count': 2}
  - {'key': 'Service Control Manager, 7023', 'Count': 1}
defender: {'AntivirusEnabled': True, 'RealTimeProtectionEnabled': True, 'AntivirusSignatureAge': 9}
findings:
  - Microsoft-Windows-Kernel-Power, 41 x3: unexpected shutdowns (power loss, PSU, overheating or a crash).
  - Microsoft-Windows-WindowsUpdateClient, 20 x2: Windows Update installs failing: Settings > Windows Update > Update history shows the KB; run the Windows Update troubleshooter.
  - Defender signatures are 9 days old: run Windows Update.
next:
  - tech.py disk for drive health
  - powercfg /batteryreport /output %TEMP%\battery.html (writes one report file): design vs full-charge capacity
  - For a scored all-round checkup use desktop-commander's computer-health-check if installed.

Events it has no meaning for (here Service Control Manager, 7023) are listed under top_errors_7d without a finding. The known ones are in How verdicts are reached.

Clone this wiki locally