At some point, I noticed I was repeating the same routine every week. None of the stuff I was doing was difficult, but it was a collection of small chores that kept interrupting real work. I'd have to stop what I was doing or block out some time to handle these small tasks and then try to pick up where I left off.
It became obvious that most of these tasks follow the same steps every time, which makes them relatively easy to automate. Use a few simple PowerShell scripts, schedule them to run automatically, and they all take care of themselves now.
I automated my software updates
No more checking if everything is up to date
This one isn't uncommon, but keeping apps updated eats a lot of time when you consider how much you should do it. I try to always keep my applications updated because I want those tasty security updates, and you should, too. You don't have to constantly keep an eye on them, though. You can update most installed software with one command, but you can also turn it into a script and tell Windows to run it automatically.
Open Notepad or your preferred text editor and add this command:
winget upgrade --all --silent --accept-package-agreements --accept-source-agreements Save it as a .ps1 file, and then you can schedule it with Task Scheduler. I schedule mine to run every Saturday at midnight because I'm based in Japan and I want all the updates that happened over the week, but I also don't want them updating during my normal working hours.
Once it's set up, you won't have to think about updates anymore. XDA expert Tim Li also mentions this script when he discusses how he makes Windows maintain itself. It's very useful.
Catch disk space issues before they become real problems
Automate your disk space monitoring
My disk space problems had a habit of appearing at the worst possible moments, especially on my older laptop with little storage space. This doesn't happen much anymore (I automate the monitoring and my drive has more storage space), but I used to spend a lot of time trying to manage things and keep it clean.
A small PowerShell script keeps an eye on this for me. It checks each drive on my system and calculates how much free space is left. If the available space drops below 20%, the script prints a warning. You can adjust the threshold to whatever percentage you want. If your storage space isn't below the set threshold, you're good. It will print a warning if it is, though.
6 PowerShell scripts to automate and speed up your workflow
When you work through the CLI you save a lot of time. Here are PowerShell scripts to speed your workflow.
For the purpose of this article, I ran the script in PowerShell at a 20% threshold. You'll notice nothing was printed. Then I changed it to 90% so that an error would be printed. Of course, you'll want to automate this in Task Scheduler and log the results. I run every day.
Clean out the files Windows forgets about
Automate temp file and log cleanup
Speaking of storage, temporary files and old logs do pile up after some time. Programs sometimes create them during installs, updates, and everyday use. Very few programs ever clean up after themselves. Over time, those leftovers start to eat up disk space for no good reason.
This PowerShell script can handle this automatically. It scans common temp folders and permanently deletes files that are older than a set number of days. In my case, 30 days.
I run this script once a week, and it prevents those directories from growing out of control without me having to manually spend my time going through everything. It's just one less thing I have to think about.
Make sure your backups actually exist
Automate your backup checks to prevent a major headache and time drain
Backups usually run quietly in the background, and that's convenient until the day they stop working. Depending on your setup, you may not even know that a drive was disconnected or a schedule is broken. You'll definitely notice when you actually need the backup and discover it's not there, though. Been there, done that.
This PowerShell script checks it for me automatically. It looks inside my backup folder, finds the most recent backup file, and checks when it was last created. If the newest backup is older than expected, in my case, one day, then the script prints a warning message.
I have this script run automatically on a daily basis. It's a nice little safety net in addition to everything else I have set up, and it saves me from having to double-check or be paranoid that something is broken. Most days it reports nothing interesting, which is good. But if something's wrong, the script tells you, and that's much better than learning about the problem during a crisis.
PowerShell scripts removed maintenance and other things from my workflow
Once you start automating small chores, you notice how many routine things are stealing time. I now run a handful of scripts on a schedule, and most of that work just happens on its own.
I run a system health check periodically, temp files and old logs are cleared, WinGet handles my software updates, I run a backup check as a safety net which gives me peace of mind, and I also run a few environment setup scripts that prepare my machines with the tools and settings I normally use.
None of these scripts are too complicated. Together they just remove the small tasks that used to interrupt my week. Automation doesn't replace the real work, but it removes repetitive work that never really needed much of my attention in the first place.
The easiest way to start is with one script that fixes something annoying. Add another when the next chore starts bothering you. After a while, those scripts will become a nice maintenance system.
