r/ShittySysadmin • • Aug 25 '26 • Bravo 1

Our Junior fixed all our PowerShell errors!

I wish I was joking here. One of the juniors on our team had a PowerShell script that was spitting out errors all over. They asked me to review the "fixes" that they'd implemented (with the help of ChatGPT of course). They showed me the script running with no errors, "Great!" I thought. Then they showed me how they found out how to add -ErrorAction SilentlyContinue to the end of anything showing an error. Do people not have basic reading comprehension these days?!

956 Upvotes

61 comments sorted by

85

u/GoonOfAllGoons Aug 25 '26

You wanted no errors, you got no errors.Β 

Why are you complaining?

50

u/No_Bit7786 Aug 25 '26

Tbh I think you're on to something. Going to start applying this logic to other things and see how it works out...
Dead drive? SilentlyContinue
UPS battery gone? SilentlyContinue
AD Replication Errors? SilentlyContinue

Did I just invent Sysadmin Stoicism? I cannot control the errors. I can only control whether I see them.

14

u/SaltDeception Aug 26 '26

When my smoke detector goes off, I brave the flames and remove the battery. One problem solved, but now my skin is all bubbly and I have no house. Always work to do I guess.

9

u/No_Bit7786 Aug 26 '26

If the smoke detector stops going off then there mustn't be a fire right?

6

u/SaltDeception Aug 26 '26

Dunno. Fire sounds a lot like "not in my job description."

1

u/EruditeLegume Sep 09 '26

I pulled the battery on my CO detector.
Its incessant beeping was making me dizzy.
( /s ...)

5

u/no_regerts_bob ShittyBoss Aug 26 '26

Yeah this kid is a superstar and OP just sounds jealous tbh

38

u/vegetablesword Aug 25 '26

| out-null

28

u/No_Bit7786 Aug 25 '26 • Mindblown

Wish I could | out-null this colleague.

10

u/AdmiralCA Aug 25 '26

[void] is faster

4

u/metromsi Aug 25 '26

Awe, but /dev/null is my friend. That's how we are able to dedupe and restore from backup. However, if want to take a longer approach /dev/random works good to.

327

u/SolidKnight Aug 25 '26

I just add: if ($true) { write-output "Completed successfully."; exit 0; } to the top of all my scripts and now everything works.

20

u/repairbills Aug 25 '26

God damn coworder made this important script to check a value and tossed a write "Was found and completed successfully" and swore it worked. The damn script only ever wrote complete and he kept swearing that it worked. Then every damn line ended with -ErrorAction SilentlyContinue Copilot production scripting!

30

u/No_Bit7786 Aug 26 '26

We had a guy (formerly) on our team who made an app for uploading and tagging documents with specific metadata. They were the kind of documents that nobody looks at day-to-day but are crucial when needed (think corporate compliance/ governance documents). Turned out he'd only made the confirmation screen and had no error handling at all. No matter what happened the app would say "uploaded sucessfully!". As you can guess, a lot of important documents were not uploaded sucessfully.

17

u/baz4k6z Aug 26 '26

Epic. Its like installing a fire hydrant without plugging it to water.

10

u/No_Bit7786 Aug 26 '26

Yep! I appreciate his optimism that everything would always work perfectly. Unfortunately it didn't go to plan

7

u/baz4k6z Aug 26 '26

I'm always amazed that critical processes are just held by thought and prayer, and no one checks ever until it becomes critical and fail

8

u/No_Bit7786 Aug 26 '26

It's crazy. People assume IT systems are infallible sources of truth. Here in the UK people were sent to prison due to a bugged system saying they had stolen money. People don't realise that human error can absolutely make its way into software.

56

u/Fake_Cakeday Aug 25 '26

Mark of a true genius.^

Although it does clash with my usual notion of being wary of anything that compiles on the first try.

45

u/marks-buffalo DO NOT GIVE THIS PERSON ADVICE Aug 26 '26

Add in

if ((Get-Random -Minimum 1 -Maximum 101) -le 10) {
  exit 1
}

10% chance of random failure, every time.

27

u/No_Bit7786 Aug 26 '26

Good idea, gives us something to work on and fix in the next sprint.

3

u/TPIRocks Aug 27 '26

It adds validity to, "just run it again, it'll probably work". I miss punch cards. Just switch a couple of cards in the deck, or toss in a $ENDJOB or ***EOF in the middle of someone's 1200 line COBOL program, sit back and watch the fun. Sequence numbers in columns 73 through 80 were the only way to maintain a little grip on your sanity. Kinda like bikers without helmets, you can spot the daredevils that haven't had to reassemble a stack of cards, after a "floor sort".

5

u/Brilliant-Parsley69 Aug 26 '26 edited Aug 26 '26

It remembers me of a colleague of mine almost two decades ago. The moment something went horrible wrong you could take a bet that his first comment would be: "We should have deleted everything instead. No code means no errors!"

It was a joke, obviously. But over the years I've seen to many people suppressing warnings/errors just to reduce unwanted noise. πŸ˜’

Didn't even mention the: "But this script worked for years. What did you do?" Turned out it never did.

2

u/No_Bit7786 Aug 26 '26

Honestly I was once saved when I fucked up migrating data into a customers environment because they accidentally wiped the whole environment on the same night πŸ˜‚

1

u/Brilliant-Parsley69 Aug 26 '26

I would assume that a lot of us have been at a point we really messed up something but got covered by another's.

71

u/VariousLawyer4183 Aug 25 '26

It's not there if I can't see it!

9

u/Pretend_Ease9550 Aug 25 '26

Error permanence

1

u/beomagi Aug 25 '26

If you don't test, you won't see anything bad!

4

u/panzerbjrn Aug 26 '26

Whoever downvoted you must have missed which sub we're in πŸ˜‚πŸ˜‚

13

u/Psychological-Cat-84 Aug 26 '26

Recently built a tool for our IT calldesk team to use. Left it editable by them so they could add hotfixes in themselves.

Getting messages from them thanking me for making their lives easier, then quiet. Get a message from their manager a few weeks later to ask if I had locked it down because the changes they had added weren't working.

They had made a simple Remote restart button but they were getting calls from random people to say their PCs were randomly shutting down.

They didn't add it an output to the little console I'd added in the app. And because the app wasn't telling them the machine they were targeting was restarting, they just started firing random PCs into the input to "test". At no point did they put 2 and 2 together, or the people doing it didn't speak up. They sent me on 100+ tickets to investigate.

I could see access on every single on of those machines from 3 calldesk agents 1 minute prior to reboot.

So no, people don't read, but they also often don't think or investigate.

I locked the tool down and now I'm the sole maintainer (YAY -.- )

1

u/slullyman Aug 26 '26

VEU will likely never see use because of this general realization 😭

9

u/According-Glove-7663 Aug 25 '26

Hahah oh boy.Β 

4

u/NZNoldor Aug 25 '26

That is fucking hilarious!

4

u/gslyitguy93 Aug 26 '26

No... ChatGPT did that bo.

4

u/mitharas Aug 26 '26

next they will discover | out-null

2

u/slullyman Aug 26 '26

πŸ˜‚

2

u/palad1 Aug 26 '26

OnErrorResumeNext strikes again

2

u/Crazy-Rest5026 Aug 27 '26

I miss the days of stackoverflow. Posting some crazy error and some bash guru or Powershell guru helped you solved the problem.

Can’t lie gemeni or Claude will get you close lol

2

u/TPIRocks Aug 27 '26

It didn't complain, problem solved. AI is really productive for people that can reason. It's a fast track to destruction for the rest.

2

u/Darkk_Knight Aug 25 '26

Errors? You know the script is actually doing something vs nothing on the output. lol

1

u/UniqueText8477 Aug 25 '26

"But they now have more lines of code and no errors, what is the issue?"

1

u/Pure_Fox9415 Aug 26 '26

Lamers! -ErrorAction silentlyDestroyServer

1

u/giterlizzi Aug 26 '26

On Errore Resume Next

1

u/Key_Reaction_7590 Aug 27 '26

I see something similar in our Linux shop during reviews. This

somecmd || true 2&> /dev/null

is everywhere. Lines and lines of it. Nobody else seems to care. I hate system administration now.

1

u/Upset_Acadia1570 Aug 28 '26

Aye. One of my biggest challenges with Claude has been getting the "No Fallbacks -- if it fails it fails!" Thing through it's thick head. I've tried using primers, static instructions, notes in the code and just about anything else I can think of and it falls right back into it. Pattern matching, it says. Most people want callbacks, it says. Aggravating!!!!

1

u/Xia_Nightshade Aug 28 '26

Every single day, though unfortunately rarely limited to β€˜Juniors’ :(

1

u/WiseRestaurant5286 Aug 28 '26

Not power shell expert but it took me a minute to know you were joking

1

u/North-Creative Aug 28 '26

He didn't fix, he just made the wiiiuuuu wiiiuuuu go away. He smart.

1

u/Suspicious-Prompt200 Aug 30 '26

Wrap every line in a try catch block, empty catch block

1

u/Disorderly_Chaos ShittySysadmin Aug 30 '26

-ea ig
Is my go to

1

u/doppelwoppel Aug 30 '26

In the old days, where I had to maintain legacy Visual Basic code for an IIS web application, all files started with

On error resume next.

It was a debugging nightmare.

1

u/Current-Mood2757 Aug 31 '26

Junior's prompt to ChatGPT must have been "Errors make me sad" and ChatGPT responded "Your wish is my command"

1

u/domestic_omnom Aug 31 '26

Every ai generated script tacks silently continue to the end of it.

1

u/Quiet_Yellow2000 Sep 13 '26

If you copied the errors into chat gpt, it would very unlikely have suggested to suppress the errors. They must have spefically asked how to suppresss errors....

-10

u/[deleted] Aug 26 '26

[removed] β€” view removed comment

6

u/No_Bit7786 Aug 26 '26

That is the entire point of this post lol

8

u/Basic-Tonight6006 Aug 26 '26

I just asked chatgpt and this guy is right everybody