Skip to content

About

A bodyguard for slow Windows PCs: frees memory before it runs out, tames background hogs, trims unneeded Microsoft services and pauses Windows Update. Pure PowerShell.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

29 Commits

Folders and files

Repository files navigation

PotatoGuard

PotatoGuard

A self-healing bodyguard for slow Windows PCs.

It sees a freeze coming, prevents it, and rescues the PC when one happens anyway,
without ever closing your work.

Latest release Windows 10 and 11 PowerShell 5.1 MIT license


Download  ·  Install  ·  What it does  ·  Updates  ·  Settings  ·  Specification  ·  Changelog


Prevent

The program you are using is kept supplied with processor time and memory, so a hesitation never becomes a freeze.

Rescue

When a window stops answering, PotatoGuard finds out why and removes what stands in its way.

Never destroy

No program is closed without your click. Unsaved work stays where it is.

Install

Step What to do
1. Download Get PotatoGuard-Setup.exe from the latest release. It is one small file; there is nothing to unzip.
2. Run it Double-click the file. If Windows shows Windows protected your PC, choose More info, then Run anyway.
3. Click Next The first screen says what PotatoGuard does.
4. Choose Windows Update Pick one: Saturday and Sunday only, Off (paused) or Leave Windows Update alone. The line underneath says what your choice means. See Windows Update.
5. Click Install A progress bar runs for a few seconds. Windows asks for administrator approval once, for the service changes. Choose Yes.
6. Click Close PotatoGuard is now running and starts by itself at every sign-in. There is nothing to open and nothing to configure.

Using it

After installing, PotatoGuard works on its own. It lives in the notification area, next to the clock (click the small arrow there if the icon is hidden).

Action Result
Hover over the icon Shows the state, free memory, processor use, how many programs are held back and the biggest memory user.
Right-click, Rescue now Relieves a PC that is lagging at this moment.
Right-click, Restart Appears only while a program is not responding. It is the only way a program gets closed, and only when you click it.
Right-click, Open log Shows everything it has done, in plain sentences.
Notifications It tells you when memory is almost full, a program is not responding, or the drive is nearly full. It never opens a window of its own.

Setup options

The setup can also be run from a command line.

Command Effect
PotatoGuard-Setup.exe Normal install, with the steps above
PotatoGuard-Setup.exe /S Silent install. Windows Update is paused unless one of the next two options is added.
... /S -WeekendUpdates Silent install, updates on Saturday and Sunday only
... /S -NoUpdatePause Silent install, Windows Update left alone
PotatoGuard-Setup.exe /verify Unpack the payload to %TEMP%\PotatoGuard-setup and install nothing

Requirements: Windows 10 or 11, Home or Pro, with the built-in Windows PowerShell 5.1. Nothing else to install.

Install from source instead

The setup runs exactly the files in this repository. Clone it and run, in a normal PowerShell window:

powershell -ExecutionPolicy Bypass -File install\install.ps1
Option Effect
-WeekendUpdates Updates on Saturday and Sunday only
-NoUpdatePause Leave Windows Update alone
-NoAdminPart Install only the live guardian: no service changes, no administrator prompt

What it does

The live guardian runs as you, from sign-in, and never needs administrator rights. It is plain PowerShell: no service of its own, no telemetry, and nothing about your PC leaves it. Its only contact with the internet is the update check described under Updates.

Before a freeze

Measure What happens
Early warning Every tick, the window in front is asked to answer within 150 ms. One miss and it gets priority and the background is stepped down, seconds before Windows would call it not responding.
Memory forecast A trend of free memory and commit projects when the PC would run out. Relief starts 120 seconds before that point.
Memory priority Under pressure, background programs get a lower memory priority, so Windows reuses their memory first and the program in front keeps its own.
Careful release While memory is only tight, only programs doing nothing are emptied. A working program would read everything straight back, which is a stutter caused by the cure.
Ballooning programs A program that grows by 200 MB or 3% of RAM in a minute is caught before it eats the PC.
Processor relief At sustained 80% processor, background consumers are stepped down and put in Windows efficiency mode. One that keeps saturating drops to the lowest processor and disk priority.
A core kept clear A background program that will not calm down is kept off the first core, so the program in front always has somewhere to run.
Learning A program stepped down three times is remembered and stepped down from 60% in future. A program that takes its memory straight back is left alone for longer each time (10 minutes, then 20, 40, up to 2 hours), and the record fades by one step a day.
Focus follows you The moment you switch to a program, every limit on it is lifted.
Leftover helpers Crash reporters and tray helpers whose program is closed are ended once they have sat idle for a minute.

When a window stops answering

A window freezes for a reason, and the reason decides what helps. PotatoGuard reads the window thread's state and its wait chain, then acts on what it finds.

Reason found What PotatoGuard does
Waiting for another program Lifts every limit on that other program, and protects both until the hang ends.
Busy working, not stuck Gives it priority and steps down the background from 50% processor.
Waiting for memory or a disk Restores its memory and disk priority, and releases memory from other programs if memory is short.
Deadlocked Nothing outside can help. It is left open and you are told.

In every case the guardian first lifts its own limits on the stuck program, and never empties or throttles it while it is in trouble. After 30 seconds a notification states the reason, and a Restart item appears in the tray menu. It does nothing unless you click it, and even then it asks the program to close properly before anything is forced.

When the whole PC is in trouble

Situation Response
Desktop or taskbar frozen explorer.exe is restarted after 20 seconds, so a frozen taskbar does not mean a reboot.
The PC stalls Detected when the guardian itself wakes late. A rescue ladder releases memory, calms the background and repairs the shell.
Memory nearly exhausted An emergency path releases hard every few seconds and names the biggest consumers.
The guardian itself fails A heartbeat and a separate watchdog task restart it within minutes.

Housekeeping

Area What happens
Start-up Entries you blocked cannot add themselves back, and a new one is reported.
Idle time A thorough memory release runs after eight idle minutes.
Bluetooth Switched off after 30 minutes with nothing connected.
Drive space You are warned when the system drive is nearly full.

When the disk is busy instead

Disk use is measured every ten seconds. When it stays above 90%, memory releases pause: emptying programs while the disk is already saturated only makes every read and write queue behind them. A real memory emergency still acts. While you are away, the program using the disk is named in the log.

Memory Windows holds

Defender, Office ClickToRun and the system services run as SYSTEM, where the live guardian can never reach. Their total is measured every 30 seconds, and from 350 MB the tray menu shows Free X MB held by Windows (admin). Choosing it asks Windows for permission once and releases the working sets of the largest of them. Nothing is closed, no setting changes, and declining changes nothing.

A report instead of a promise

Once a week the guardian writes a few plain lines to the log and to report.txt: how many memory releases ran, how much they freed, how often a program was left alone after taking its memory back, and how long a tick takes. Weekly report in the tray menu opens it. Nothing is sent anywhere.

Its own cost

One process scan per tick is shared by every check, every pass is time-bounded, and hang checks never block. The guardian runs at low priority and steps up only while the PC is in trouble, so it can neither cause a stutter nor be starved when it is needed. It only ever shows tray notifications, never a window of its own.

Rescue on demand

Everything is automatic, but you can ask for immediate relief in three ways:

From How
Tray icon Right-click and choose Rescue now
Start Menu Open PotatoGuard Rescue
PowerShell powershell -ExecutionPolicy Bypass -File "$env:ProgramData\PCGuardian\guardian.ps1" -Rescue

It releases background memory, calms processor consumers for a few seconds, boosts the program you are using, repairs the desktop if it is frozen, puts every priority back, and tells you what it did. It never restarts the PC.

Updates

PotatoGuard keeps itself current, so you never have to watch the download page.

Step What happens
It looks While the PC is idle, and never while memory is tight, it asks GitHub once every six hours whether a newer version has been published.
It tells you once A notification names the new version and the tray menu gains Update to X now. One announcement per version, even across restarts.
You click It downloads that release's setup file and checks it against the byte size and SHA-256 GitHub publishes for it.
It installs Only a matching file runs, silently, and the guardian returns on the new version: no window, no administrator prompt, no reboot. Your protected list, log and settings are kept.
If it does not match Nothing is run. The file is deleted and the release page opens, so the decision stays yours.
If it will not start The installer keeps the version you have and puts it back if the new one does not report in within a minute.
Signed releases A release can be signed. Once its certificate is pinned, any setup not signed by it is refused before it is run, not after.

Nothing installs without your click, and the check sends nothing but the guardian's own version number.

Updates arrive by themselves from 1.3.0 onwards. A 1.2.0 or older copy has no updater yet, so install 1.3.0 once by hand.

Settings

Plain text files, one entry per line, re-read every 10 minutes. No restart is needed. All of them are in %ProgramData%\PCGuardian unless stated.

File Purpose
protected.txt Programs that are never touched: a build, a recording, a call. Names without .exe.
idle-helpers.txt Extra helpers to close. helper = program, program closes it while none of those programs is open. helper alone closes it whenever it sits idle.
blocked-autostart.txt Start-up entries to keep out. Wildcards allowed.
learned-hogs.txt What it has learned. Delete the file to forget.
keep-services.txt Services the admin part must leave running. This one is in %ProgramFiles%\PCGuardian.

Logs

Each file is capped at 200 KB. The first two open from the tray menu.

File Contents
guardian.log Every action, in plain sentences. In %ProgramData%\PCGuardian.
recovery.log Stalls, hangs and rescues, one JSON object per line. In %ProgramData%\PCGuardian.
admin.log What the admin part changed. In %ProgramFiles%\PCGuardian.

The admin part

Optional. It runs as SYSTEM at start-up and every 3 hours, and re-applies whatever Windows turns back on.

Area Change
Services Stops and disables Microsoft services most people never use: telemetry, error reporting, diagnostics, Xbox, Insider, retail demo, maps, wallet, mixed reality, device setup, sensors, imaging, the search indexer and SysMain. The full list is at the top of src\guardian-admin.ps1.
Scheduled tasks Disables the telemetry and error-reporting tasks.
Policies Turns Widgets and telemetry off, and sets the foreground time-slice preference so the window in front keeps its share.
Windows Update Handled the way you chose at install. Defender definitions are refreshed once a day in every case.
Never touched Networking, Wi-Fi, hotspot, Defender, audio and certificate services. The update services themselves stay enabled, so the Microsoft Store keeps working.

Windows Update

You choose one of three modes on the second setup screen. Run the setup again to change it.

Choice What it means
Saturday and Sunday only Updates are paused from Monday to Friday, so they never interrupt a working day. At the weekend the pause is lifted and Windows is asked to check for updates. The switch follows the calendar within 3 hours.
Off (paused) Updates stay paused, and are paused again if Windows lifts the pause.
Leave Windows Update alone PotatoGuard does not touch Windows Update at all.

Warning

With Off (paused), no security patches arrive. Choose one of the other two if you want updates.

See exactly what the admin part changed, with the state before and now:

& "$env:ProgramFiles\PCGuardian\guardian-admin.ps1" -List

Uninstall

The setup keeps a readable copy of every script, so this works long after the download is gone:

powershell -ExecutionPolicy Bypass -File "$env:LOCALAPPDATA\PotatoGuard\setup\uninstall.ps1"

Every service, task, registry value and radio state goes back to what it was, from the record kept when PotatoGuard first ran, and the services that were running before are started again. It then removes its scheduled tasks, its shortcut, the downloaded update and all three of its folders, so nothing by PotatoGuard is left on the PC. At the end it checks each of those places and lists anything still there instead of claiming success.

powershell -ExecutionPolicy Bypass -File uninstall.ps1 -DryRun     # print the plan, change nothing
powershell -ExecutionPolicy Bypass -File uninstall.ps1 -KeepData   # keep the log and lists for a bug report

The setup asks for administrator approval once, for the service and registry part. If you decline it, the uninstall says so plainly and names what is still in place; run the script again from an administrator PowerShell to finish.

Antivirus and SmartScreen

The setup is unsigned. Nothing in it is packed, encrypted or obfuscated: the scripts are embedded as plain text, the same files as in this repository, and are unpacked to %LOCALAPPDATA%\PotatoGuard\setup.

If you see What to do
Windows protected your PC Choose More info, then Run anyway. SmartScreen asks because the file is new and unsigned.
An antivirus quarantine It is a false positive. Report the file to the vendor, or build it yourself with tools\make-installer.ps1.

Only a code-signing certificate removes the warning for everyone.

For developers

Folder Holds
src\ What runs on the PC: the guardian, the admin part, the watchdog and their launchers
install\ install.ps1, install-admin.ps1, uninstall.ps1
tools\ make-installer.ps1, make-icon.ps1, selftest.ps1
assets\ The icon and the picture
docs\ SPEC.md: requirements, safety rules, performance budget and traceability
tests\ The test suite: the guardian's own rules, the installer's rollback, and version and specification consistency

Build the setup program with the C# compiler that ships with Windows. The result is dist\PotatoGuard-Setup.exe.

powershell -NoProfile -ExecutionPolicy Bypass -File tools\make-installer.ps1

Run the self-test. It re-runs the tray Restart path against its own probe windows, prints one PASS or FAIL line per check, and exits 0 or 1.

powershell -NoProfile -ExecutionPolicy Bypass -File tools\selftest.ps1

Run the test suite. It needs no framework: it pulls the rules out of the real scripts, checks them against fixed cases, and prints one PASS or FAIL line per check. CI runs it, and builds the setup, on every push.

powershell -NoProfile -ExecutionPolicy Bypass -File tests\guardian.tests.ps1

License

MIT

About

A bodyguard for slow Windows PCs: frees memory before it runs out, tames background hogs, trims unneeded Microsoft services and pauses Windows Update. Pure PowerShell.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages