A PowerShell tool for doing low-level maintenance and safety checks on Windows computers used in a supervised program. Scans a machine, offers to fix and clean things, and uploads a single diagnostic report to your private Google Drive after you approve it from your phone with a free and secure Google Apps Script backend. Nothing sensitive is stored on the computer it runs on. Perfect for any kind of nonprofit needing free, open-source, and easy software to manage many computers at once periodically, and easily.


Inspiration

For around 2 years, I volunteered as a network/computer maintenance person for this local nonprofit organization that helps educate and provide physical and occupational therapy to special-needs young adults and adults. In this organization, they have two locations, both with a few computer labs ranging from 15-25 computers in each lab. These computers were used for lots of things, such as during class time as an educational tool, or simply available for entertainment purposes. At the beginning of my time there, students could browse the whole internet, more or less, which exposed the computers and the network to viruses and other vulnerabilities, as students often visited illegitimate or inappropriate websites.

My primary job was to visit between 1-4 times per month to perform regular maintenance on the computers, including running virus checks, updating software, cleaning up files, uninstalling unauthorized software, blocklisting websites they shouldn't be on, deleting sensitive saved passwords, and many other things. Since there was often a lot fixed on a computer, I started writing reports for each computer for what I had fixed, what was wrong with it, and if any further action needed to be taken. As I would work on upwards of 25 computers in a day, between writing reports and going from computer to computer, it was extremely time-consuming. As a volunteer, I'd be spending sometimes 4 hours there, while still having impending homework and studying to do for AP and honors classes.

So I built secdiagdrop, combining security and diagnostics easily. I wanted a way to streamline this process. Mostly everything I was doing from computer to computer was the same, making it easily repeatable with a script. The script I wanted to make would check software, unsafe downloads, inappropriate websites, viruses, and lots more, and not only suggest remediation or resolving of those issues, but also including those issues in a report. That was the second piece of the puzzle: I wanted the script to be easily and securely deployable, and once finished with execution, wouldn't stay on the computer, so only existing in memory. I also wanted the diagnostics collected to be easily uploadable to a sharable platform, like Google Drive. I accomplished this with a Google Apps Script. The report would go to my Drive, which I could share with the program coordinator. This allowed them to see anything I was doing, and I could also outline anything of concern (i.e. finding someone's banking password).


How it works

Essentially, what runs the PowerShell script is a simple .cmd file, which I have on a thumbdrive. Once I plug in the thumbdrive and click the .cmd file, I can immediately unplug the thumbdrive and move onto the next computer, as that .cmd file loads the PowerShell script (on the GitHub repo) into memory. Once that PowerShell script is loaded into memory, it prompts the user for a password. That password is set and hashed on the Google Apps Script, and isn't checked until the end of the PowerShell script, which deters brute-force. If the password is correct, once the script has completed with the suggested actions and documenting diagnostic changes, a 2FA email is sent to my address, prompting me to accept or deny the upload of the diagnostic report to a specific folder on my Google Drive. If the password is incorrect, it offers to save the diagnostics to a local .txt file.

Abbreviated

  1. You run one launcher file from a USB stick.
  2. The launcher pulls the current script from your GitHub repo (or wherever you want it stored online) and runs it in memory - nothing is written to the machine's disk.
  3. The script asks for a password only you know, then a few intake questions.
  4. It scans the machine (disk, drive health, files, software, startup, browser, security) - all read-only, changing nothing.
  5. It offers to fix/clean/remove things - you confirm each one.
  6. It asks what you fixed, builds one report, and sends it to your endpoint.
  7. If your password you entered before was correct, your phone gets an email with the machine's details and an Approve / Deny button. Only when you Approve does the report save to your Drive. If the password was incorrect, it asks if you'd like to save a local report, and never touches your Drive or Gmail account.
  8. On exit, every temporary file is securely wiped. Nothing is left behind.

Email notification asking for approval to upload a diagnostic report

View an example diagnostic report (opens in new tab).


Results

This workflow checked all of my boxes—no script lives locally on the computer, script is easily deployable between computers, increases efficiency, and uploads very easily and securely. And it helped a lot! This reduced my time spent from upwards of 4 hours per day to about 1. Before I made secdiagdrop, I did some research to see if any software like this existed, that is, open-source, free, easy to use, customizable, and secure. To my surprise, nothing like this really exists. Hopefully this will be of use to someone, someday, but if not, it definitely made my life easier.


The three moving parts

Part What it is Where it lives
Invoke-PCMaintenance.ps1 The main script that does everything Public GitHub repo
sqlite3.exe A small tool, fetched only if you approve a deletion Same GitHub repo
DiagnosticDrop.gs Google Apps Script: checks your predefined, script-specific password, emails you the approval, saves the file to Drive script.google.com
RUN-MAINTENANCE.cmd Tiny launcher that starts the whole thing Your USB stick

The GitHub repo is public and contains no secrets. The only secret is your password, which you type at runtime and which is double-checked by the Google side, or an email that you must manually approve for the diagnostic file to be saved to your Drive. The reason that Invoke-PCMaintenance.ps1 isn't on the thumb drive is because this workflow was designed with swift use in mind. Meaning, a technician could go from computer to computer very quickly by simply plugging in the thumb drive, running the .cmd file, which would open the .ps1 file via the public repo link, and then the technician could unplug the drive safely and move on, with the PowerShell script starting automatically once a password was typed in. Multiple thumb drives are not needed for this workflow, only one thumb drive and one person.


Why nothing sensitive is exposed

  • The script and its URLs are not secret. The endpoint URL is useless without your password.
  • Your password is never stored. You type it each run, hidden. It is stored in memory only and is wiped on exit. The Google side stores only a one-way hash of it and rate-limits guesses (5 wrong tries locks it out), so a memorable password is safe.
  • The diagnostic never touches the machine's disk. It's built in memory and uploaded. (If upload fails, you're offered a local save to the Desktop.)
  • Saved passwords flagged by the script are never read. The browser check only sees which sites have saved logins, by domain - never the passwords themselves.

What the scan looks at

All of the following is customizable by modifying the PowerShell script. This was the script that worked for me in the environment I used it in, but you may be different with your use case.

  • System summary - OS, model, CPU, RAM, uptime, memory pressure
  • Disk usage - flags any drive over 50% full
  • Drive health (SMART) - SSD wear, temperature, failure prediction, disk errors
  • Files - Desktop + Downloads, flagging large/stale/executable/suspicious files
  • Installed software - full list + recent installs
  • Flagged software - junkware, scareware, remote-access tools, miners, etc.
  • Games + unauthorized software - game launchers, VPNs, torrent clients, etc.
  • Startup apps - everything set to run at boot/login
  • Browser - risky extensions, hijacked settings, dangerous domains in history, inappropriate content (for safeguarding), and saved-login domains
  • Security posture - Defender, firewall, BitLocker, pending reboots
  • Temp/cache - reclaimable space
  • Windows Update - pending updates

These flagged thresholds can be modified in the PowerShell script.

What it can fix/remove (only after you confirm each)

  • Delete flagged files from Desktop/Downloads
  • Uninstall games and unauthorized software (shown as a list first)
  • Remove saved financial or inappropriate-site logins (by domain)
  • Clear inappropriate browsing history (preserved in the report first)
  • Install Windows updates
  • Open Disk Cleanup
  • Recommended options (multi-select): remove BitLocker, empty Recycle Bin, flush DNS, create a restore point, run SFC, disable hibernation, enable Storage Sense, restart

Everything destructive is opt-in, one prompt at a time, at the end of the run.


Safeguarding

These machines may be used by minors, so the tool takes extra care:

  • Inappropriate content (adult/gambling) found in history is recorded in a confidential section of the report before anything is deleted, so a record always reaches you even after cleanup.
  • Report any illegal activity to law enforcement. Preserve any evidence of such activity.
  • Make sure your program's overseers have approved this tool in writing before using it on real machines. It scans browsing and removes data on computers used by vulnerable people, which should be authorized, not improvised.

One-time setup

1. Google Apps Script (Drive + approval)

  1. Paste DiagnosticDrop.gs into script.google.com. You will fill in FOLDER_ID, PASS_HASH, YOUR_EMAIL with your own, accurate secrets.
  2. Create a Drive folder. Copy its ID from the URL. Paste it into the appropriate spot on the .gs file.
  3. Pick a password you'll remember. Compute its SHA-256 hash (this can be done on Windows, Linux, or MacOS; just Google it). Put that in the appropriate spot on the .gs file. If you forget that password, simply recalculate a hash of a password you know, and update it in the .gs file.
  4. Deploy as a Web app in Google Apps Script: Execute as Me, Access Anyone.
  5. Copy the /exec URL.

After any edit to the Apps Script, redeploy a New version or the old code keeps running.

2. GitHub (host the script + sqlite tool)

  1. Put Invoke-PCMaintenance.ps1 in a public repo.
  2. Download the official sqlite-tools zip (not the DLL one), take sqlite3.exe, upload just that. This functionality is for database control on the script.
  3. In the script's $Config, set UploadEndpoint (your /exec URL) and SqliteToolUrl (the raw sqlite3.exe URL). Leave Password empty.

3. The launcher

Put RUN-MAINTENANCE.cmd on your USB stick and set its SCRIPTURL to your raw script URL.


Running it on a machine

  1. Double-click RUN-MAINTENANCE.cmd (right-click -> Run as administrator for full results).
  2. A window opens rooted in the temp folder - you can remove the USB now.
  3. Type your password (hidden), answer the intake questions.
  4. Let the scan run; confirm each fix/removal at the end.
  5. Answer "what did you fix?"
  6. Your phone buzzes - tap Approve on the email.
  7. The report lands in a dated MM-DD-YYYY folder in your Drive.
  8. Press Enter; the screen clears and temp files are wiped.

Health check

Confirm the Google endpoint is alive (no password needed):

https://YOUR-EXEC-URL/exec?action=ping   ->   {"ok":true,"alive":true}

Good to know / limitations

  • Run as administrator or update installs, BitLocker changes, SFC, restore points, and some checks won't work. To make this easier, you can change the CMD file to always ask for admin access so you don't have to right click on it every time.
  • If a browser is open during the scan, the newest history entries might be missing from the read. Deletions close the browser first.
  • The tool needs outbound HTTPS to GitHub, your Google endpoint, and (for geo) an IP lookup service. Locked-down networks may need these allowlisted.