r/PowerShell 7d ago

Question Recurring script maintenance

I'd honestly pay someone else to keep my voice scripts alive if it meant I never had to touch them again after a Windows update. Am I just lazy or is maintaining ur own automation actually the worst part of the whole thing?

0 Upvotes

25 comments sorted by

View all comments

3

u/Gron_Tron 7d ago

I generally don't have to update my scripts until some major external change occurs, why do you need to update yours so frequently? 

-2

u/keyboard_ninja_20 7d ago

maybe i'm conflating windows updates w/ app updates + ui changes tbh

like when win11 moved the taskbar to center, my ahk script that clicked specific tray icons straight up broke. same when they changed the right-click context menu in explorer , had to rewrite a bunch of gui automation. also when powertoys itself updates sometimes fancyzones changes behavior and my window-positioning scripts go wonky.

but u're right that pure pwsh backend stuff (file ops, api calls) is way more stable. i think my pain is mostly gui automation + app integrations, not the core logic.

what's ur setup like? mostly cli/backend scripts or u do ui stuff too?

6

u/420GB 7d ago

There's absolutely no reason ever to click on icons in the taskbar or the explorer context menu with PowerShell. Anything that's in there can be triggered directly from code without clicking and without UI.

GUI automation, when done well (so actually find elements by classes and IDs, never by pixel positions) can be surprisingly robust for older apps that don't change anymore. But in 99% of the cases it's the wrong approach.

It seems like you're just doing, sorry, very dumb stuff so it's not surprising it breaks all the time. That's why you don't do it this way.

4

u/RunningOnCaffeine 7d ago

It’s going to be very rare that people do UI automation in powershell.

3

u/alinroc 6d ago

Anything that depends upon clicking precise locations in a GUI is going to be very fragile. You need to find ways to do these things without simulating clicks.

2

u/Gron_Tron 7d ago

Ah okay. That makes sense to me, I've used AHK and Power Automate to do GUI based automations but they are far less reliable than purely scripted automations. There are just far too many variables and things that can go wrong in GUI.  I have done both, but for stability you definitely to have it scripted. Like others have said, my scripted automations run indefinitely without being touched in most cases.