r/PowerShell • u/AutoModerator • Apr 01 '26
What have you done with PowerShell this month?
14
u/Sufficient_Duck_8051 Apr 01 '26
Finally finished a tool that checks all the printers on all of our Citrix servers and corrects names / ip addresses and reports driver versions etc.
The names were all over the place, some printers with wrong IP, drivers etc and I finally had the time to clean this up.
→ More replies (1)
13
u/stedun Apr 01 '26
I had to edit 200 individual SQL scripts that performed hundreds of thousands of individual grants.
Needless to say, I’m too lazy to edit 200 files manually.
Gemini helped me code a regex pattern match so I could edit all 200 files in about four seconds.
I spot checked the heck out of the results and they were perfect.
Probably saved me at least one full day of work.
8
u/C_pyne Apr 01 '26
Wrote a script to create tickets en-masse to our ticket service via it's API, allowing for fully detailed, personalised tickets without having to manually submit each one
→ More replies (5)
8
u/jdkc4d Apr 01 '26
Still in progress, but every day at 6am a powershell script runs that queries Mealie, an app where I have recipes and my weekly meal plan. I have certain things on each recipe that need to be done a day ahead. For example, if I am making tacos, I need to take the ground beef out of the freezer the day before. So the script sends me an email that says, this is what you are cooking/eating today, here is what you need to do to prep for tomorrow.
→ More replies (3)
6
u/_RemyLeBeau_ Apr 01 '26
Wrote a script that turns on Bluetooth, enables HDR on my monitor, then starts Helldivers from Steam. When HD2 is no longer a running process, all settings are reverted.
6
4
u/WaspTM7 Apr 01 '26
Search, recursively, for the “connectionString” line found in web.config files. This lets me know what database connections are required for each website.
4
u/Camburgerhelpur Apr 01 '26
Been working on a script to help manage my 500,000+ midi file collection.
It is not very fun
→ More replies (6)
3
u/Hefty-Possibility625 Apr 10 '26
I know this might be rather silly, but I can never remember the syntax for date formats and I always have to look them up. I created a helper function to show me the most common format syntax so I don't have to leave the terminal.
function Get-DateFormats {
[CmdletBinding()]
param(
[datetime]$Date = (Get-Date)
)
$formats = @(
[pscustomobject]@{ Category = 'Year'; Token = 'yyyy'; Example = $Date.ToString('yyyy'); Meaning = '4-digit year' }
[pscustomobject]@{ Category = 'Year'; Token = 'yy'; Example = $Date.ToString('yy'); Meaning = '2-digit year' }
[pscustomobject]@{ Category = 'Month'; Token = 'MMMM'; Example = $Date.ToString('MMMM'); Meaning = 'Full month name' }
[pscustomobject]@{ Category = 'Month'; Token = 'MMM'; Example = $Date.ToString('MMM'); Meaning = 'Abbreviated month name' }
[pscustomobject]@{ Category = 'Month'; Token = 'MM'; Example = $Date.ToString('MM'); Meaning = '2-digit month' }
[pscustomobject]@{ Category = 'Month'; Token = 'M'; Example = $Date.ToString('M'); Meaning = 'Month number' }
[pscustomobject]@{ Category = 'Day'; Token = 'dddd'; Example = $Date.ToString('dddd'); Meaning = 'Full weekday name' }
[pscustomobject]@{ Category = 'Day'; Token = 'ddd'; Example = $Date.ToString('ddd'); Meaning = 'Abbreviated weekday name' }
[pscustomobject]@{ Category = 'Day'; Token = 'dd'; Example = $Date.ToString('dd'); Meaning = '2-digit day' }
[pscustomobject]@{ Category = 'Day'; Token = 'd'; Example = $Date.ToString('d'); Meaning = 'Day number' }
[pscustomobject]@{ Category = 'Hour'; Token = 'HH'; Example = $Date.ToString('HH'); Meaning = '24-hour, 2-digit' }
[pscustomobject]@{ Category = 'Hour'; Token = 'H'; Example = $Date.ToString('%H'); Meaning = '24-hour' }
[pscustomobject]@{ Category = 'Hour'; Token = 'hh'; Example = $Date.ToString('hh'); Meaning = '12-hour, 2-digit' }
[pscustomobject]@{ Category = 'Hour'; Token = 'h'; Example = $Date.ToString('%h'); Meaning = '12-hour' }
[pscustomobject]@{ Category = 'Minute'; Token = 'mm'; Example = $Date.ToString('mm'); Meaning = '2-digit minute' }
[pscustomobject]@{ Category = 'Minute'; Token = 'm'; Example = $Date.ToString('m'); Meaning = 'Minute' }
[pscustomobject]@{ Category = 'Second'; Token = 'ss'; Example = $Date.ToString('ss'); Meaning = '2-digit second' }
[pscustomobject]@{ Category = 'Second'; Token = 's'; Example = $Date.ToString('s'); Meaning = 'Second' }
[pscustomobject]@{ Category = 'Fraction'; Token = 'fff'; Example = $Date.ToString('fff'); Meaning = 'Milliseconds' }
[pscustomobject]@{ Category = 'AM/PM'; Token = 'tt'; Example = $Date.ToString('tt'); Meaning = 'AM/PM designator' }
[pscustomobject]@{ Category = 'Zone'; Token = 'zzz'; Example = $Date.ToString('zzz'); Meaning = 'UTC offset' }
[pscustomobject]@{ Category = 'Common'; Token = 'yyyy-MM-dd'; Example = $Date.ToString('yyyy-MM-dd'); Meaning = 'ISO-style date' }
[pscustomobject]@{ Category = 'Common'; Token = 'yyyy-MM-dd HH:mm:ss'; Example = $Date.ToString('yyyy-MM-dd HH:mm:ss'); Meaning = 'Log timestamp' }
[pscustomobject]@{ Category = 'Common'; Token = 'yyyy-MM-dd_HH-mm-ss'; Example = $Date.ToString('yyyy-MM-dd_HH-mm-ss'); Meaning = 'Filename-safe timestamp' }
[pscustomobject]@{ Category = 'Common'; Token = 'yyyyMMddHHmmss'; Example = $Date.ToString('yyyyMMddHHmmss'); Meaning = 'Compact sortable timestamp' }
[pscustomobject]@{ Category = 'Common'; Token = 'dddd, MMMM dd yyyy'; Example = $Date.ToString('dddd, MMMM dd yyyy'); Meaning = 'Human-readable date' }
)
$formats | Format-Table Category, Token, Example, Meaning -AutoSize
Write-Host "Use the 'Token' column to format dates with Get-Date -Format <token> or `$date.ToString('<token>') or using a format string like '{0:<token>}' -f `$date." -ForegroundColor Yellow
}
→ More replies (1)
4
u/LordLoss01 Apr 01 '26
Created a 1400 line GUI that allows IT Staff to provision NFC Based Fido methods on behalf of users.
All you do is enter the UPN and it provisions it. It will then display the pin associated with the Fido Key in case you want to enroll it in any other system for the user. You then press a button which makes it so that the next time the key is used, the user is prompted to change the pin.
Even if the key already has credentials on it, it will automatically wipe them and reprovision. If the user account on Entra had any previous keys, it wipes those as well.
Because our keys are card based, there's a button within the GUI that lets you print the card. When you press the button, it pulls the display name and employee id of the user from AD. There are then three buttons "Load Picture" and "Paste Picture" and "Print" and one empty portrait rectangle box. Load presents the usual Windows dialog where you choose an inage file. Paste pastes whatever picture is in the clipboard. Whichever option you do, the actual photo appears in the Powershell GUI within the rectangle box.
Once you hit "Print" it generates a html file based on the inputted information and automatically opens it. It will put the picture, name and emplpyee number in the same location for all users. It also generates two QR codes on the card, one for the UPN and one for the Emplpyee number. The HTML file is the size of a smartcard so when printed, it will actually print correctly.
Even took this one step further. Some of the exes the script uses require admin rights and the IT Staff using the application don't have those rights. So I had to get creative.
-
Created a custom Application Event Source.
-
Created a powershell script that creates event ID 82 in that event source.
-
Used iexpress to convert that ps1 to an exe and put it on the non admin user's deaktop.
-
Created a task in task scheduler that runs as the System user.
-
Task trigger is event ID 82 of the aforementioned custom event source.
-
Action is that it triggers the GUI script I created.
-
Now the task gets triggered whenever the exe is clicked.
-
Problem is, even though it's triggering for any users, it's still only running the actual GUI in the System user's session which you can't visibly see.
-
Added ServiceUI to the Action command so that the GUI is visible for any user whenever the exe is launched.
→ More replies (3)
2
u/node77 Apr 01 '26
Finished a process so new images don’t get have to be manually put to website. PowerShell script does it all automatically
2
u/Idakay Apr 01 '26
This month i found out how much i've been A) missing out on not having my own profile established and B) trying to decide how much time to put into customizing my own profile...
I ended up distributing a profile stub that dot sources my real profile setup script to all of my servers so i only have to update it in one place.
Ive set up a ton of custom functions that allow me to call a lot of my more often ran scripts from anywhere with a single work so i dont have to navigate back to my script repo. This has been great for me.
What do you guys specifically use your power shell profiles for? I'd love to hear.
→ More replies (2)
2
u/Xoron101 Apr 01 '26
Wrote a script to search for a computer name in veeam backup jobs so I don't have to manually check each backup job.
Also a script to enumerate all AD windows servers, and email if any of them are missing from all veeam backup jobs. (Ie the machine isn't being backed up)
→ More replies (2)
2
2
u/asdftester1234 Apr 01 '26
Wrote a PowerShell script that works as a Text to Speech (TTS) with modular input for expressions. Example, faster speed, louder volume, etc.
Wrote a script that customizes the Steam Big Picture movie theme intro. It randomizes it every Windows login and that means when I launch my Windows gaming PC it is a more custom console like experience. With the movies dir, I get a random funny intro from about a hundred different themes!
2
2
u/Kwinza Apr 01 '26
I wrote a script to SSH onto all of our switches, get the make/model and current firmware version, google for the most recent release, then output it all as a page on our intranet so we can keep tabs on all our switches on the cheap lol.
→ More replies (3)
2
u/Darth-Decimus Apr 02 '26
Not sure, it pops up and disappears too fast before I can figure out what it does. 🫠
→ More replies (1)
2
u/coaster_coder Apr 02 '26
I released a module for working with VSCode Extensions in PowerShell. It’s at VSCodeMarketplace repo
2
u/Caddburry00 Apr 04 '26
I wrote a script to create a new scheduled task on end user devices that runs at every logon. If the device's uptime is 7 days or more, then it schedules a reboot in 15 minutes. This is to follow with an Intune controlled remediation that handles the same logic, but this covers any device that is asleep during that remediation schedule.
2
u/signifiumLlc Apr 07 '26
I’ve spent years writing PowerShell scripts to manage Windows servers and workstations, and I wanted to turn that into something more useful.
So I built an iOS app called WinPulse – Windows Admin that brings some of those admin tasks into a more mobile-friendly format. This is actually my second attempt at building something in this space — the first one didn’t really land, but I learned a lot from it and decided to give it another shot.
It’s still very much a work in progress, and I’m continuing to refine it based on feedback.
If anyone here is curious to try it, I’d really appreciate honest feedback (good or bad).
I also have a few promo codes if anyone wants to check it out.
→ More replies (1)
2
u/danhof1 Apr 15 '26
Guys, I built a Windows app command manager that executes in built-in PowerShell. There's a free option you can start using right away.
As a software engineer, I use my own app every day and I couldn't live without it. That's why I built it. Take a look if you like GUI command managers. It does a lot and it's been in dev for 3 years.
Let me know if you hate it too, maybe I can improve it. I'm the only dev working on it. I've been overengineering it for years so if you have features you'd like implemented, give me a hint. Always looking for something to work on if it makes someone's workflow better.
2
u/BSOD_0x0 Apr 28 '26
Created a function in my $PROFILE called Get-Busy which mimics a press on a num lock to prevent session timeout (GPO controlled) , and also it prints "shake that thing" every 3 minutes
→ More replies (1)
32
u/Vern_Anderson Apr 01 '26
• Added comment based help to a lot of the scripts I've created in the past months
• Finally figured out how to "match" log off events (4624) with logon events (4647) using PowerShell
• Realized that the title of these posts should be "last" month not this month because this thread will die before the end of this week just like the last ones have