I usually have a number of computers I use on a regular basis. Occasionally, I decide to completely reimage my Windows machines because I feel it's usually good practice every so often. Of course you have a myriad of different options available to you these days if you need to get your machine back to a functional state (more options than were previously available).
Because I think I'm a glutton for punishment, I often rebuild my machine out brand new. I'll completely wipe the drive (after I've backed everything up to either OneDrive or an external drive) and reinstall Windows. I probably don't need to take such drastic measures as Windows 10 is more robust than other OSes, but it's hard to kill out old habits.
Whenever I rebuild, I use Chocolatey to install all the applications I need. It's my favorite package manager for Windows and is worthy of exploring if you're new to idea. The problem is I may not necessarily know or remember what I had installed prior to wiping everything clean. I built this PowerShell script a number of years back when I was a consultant and found it today while looking for some old files of mine. I thought to myself that it's still relevant to know how to extract this information. If anything, examining my script may prompt you to build some exploratory scripts of your own. 1 thing to note is you need to be logged into this server for the script to work. If you're looking for a way to do this remotely for a number of machines, let me know and I'll add some additional time into the mix to come up with a working example.
Without further ado, here's the script in full. If you don't want to click out of the blog window, here's what the script looks like visually (the link will take you to a copy/paste-able version of the script):
Hopefully seeing this script, examining its contents, and playing around prove helpful for you as you explore more of what PowerShell can help you do within a Windows computer or server. Enjoy and happy PowerShellin'!
Comments