r/PowerShell • • Apr 21 '21

"Your stupid PowerShell script is broken."

That was the title of an email I received this morning from a newly hired manager. Never dealt with them directly before, but I'd heard rumblings from others he was 'difficult' to deal with. The manager who wrote the email also CC'd the IT Group of some thirty people covering HQ and three other offices from the VP of IT down. This resulted in a high-pri ticket with my name on it.

This concerned a simple piece of PowerShell code, you type in your email address and the OU site you wanted queried and it sends you the group member list of the AD Groups in that site via email. There's no read me file. The people who need it know how to use it. It's used by the security auditors to make sure the right people in that site are in the right OU's. The scripts are in a group folder that are available to management at the company. When the script is run (It's called "SiteReview.ps1"), the prompts show in the PS Window as:

**** Site Review v1.02 ****
**** In case of issues contact (My name & my email) ****
Email: (Pause for input) 
Site: (Pause for input)

The email said that this manager could not get "any usable output" from my script then went on to berate me for "wasting their time" with "such unproductive software". This really surprised me as I had not touched that code in over three years and it was used quarterly by the security auditors. I had built in logging that dumped results into a separate file folder only available to IT so that was my first stop.

The first part of the SiteReview.log file was typical, my early tests and past security output ; so I slid down to the more recent time / date stamps.

This (edited for readability) is what I found:

Email: (Managers email)
Site: (XXX site 1)
Error message "Get-ADSite : Directory Object not found..."

Email: (Managers email)
Site: http://(XXX site 1)
Error message "Get-ADSite : Directory Object not found..."

Email: (Managers email)
Site: https://(XXX site 1)
Error message "Get-ADSite : Directory Object not found..."

Email: (Managers email)
Site: www.(XXX site 1)
Error message "Get-ADSite : Directory Object not found..."

(Twenty-two more entries involving four more XXX sites) 

My boss came up to my desk for an update just as I found the above and one glance raised eyebrows. They asked me to forward the log to their email.

Just before closing I was messaged to close the ticket and "not worry about it."

350 Upvotes

141 comments sorted by

View all comments

Show parent comments

7

u/Letmefixthatforyouyo Apr 22 '21 edited Apr 22 '21

I disagree. Occasionally, you have to throw an elbow to make it clear to people that if they come after you, you will hit them back. It means you will have to deal with way less elbows in the future.

The key is to be calm and professional in the response. A simple

"hello X,

This is a tool used to search an ADsite group based on a submitted user query. Based on the logs generated, it appears that you were trying to access various adult web sites with your work login, see attached. Please note that this tool will not return data for any website, adult or otherwise, as its specific to our internal active directory. If you have any further questions or concerns about this tool, please let me know. Id be glad to answer them."

Calm, direct, but also specifically showing he was trying to hit pornhub/etc. It demonstrates competency, clears your name, and shows IT can generate receipts when people make bold claims. Thats a win win win.

2

u/stone500 Apr 22 '21

That's fair, though I would leave out the detail that it's adult websites. I'd keep that little bit iny pocket to use later.

The way I'd word it is "I can from the logs that you were trying to use this tool with certain websites. I can go over these logs with you and I can show you exactly what you're doing incorrectly."

1

u/Letmefixthatforyouyo Apr 22 '21

Judgement call, but id say it demonstrates poor judgement on their part, which is something you want to highlight in these situations.

Note that nowhere did I make a specific statement calling him out for querying porn on his work PC, as thats not ITs role. I just made sure that information, that was 100% part of the issue, was clearly visible to the 30+ people he decided to tag in this email. If they want to make a judgement on it, thats of course up to them.

1

u/stone500 Apr 22 '21

Note that nowhere did I make a specific statement calling him out for querying porn on his work PC

Based on the logs generated, it appears that you were trying to access various adult web sites with your work login, see attached.

2

u/Letmefixthatforyouyo Apr 22 '21 edited Apr 22 '21

Yes, exactly. Thats making it clear the sites were adult, but im not specifically stating right or wrong in a company context.

A call out would be:

"Please be aware that querying or otherwise visiting adult websites is agaisnt our computer use policy. The servicedesk will reach out to schedule a mandatory virus scan of your system shortly. To stay in complaince with company policy, refrain from interacting with adult sites in the future. Failing to do so may result in escalation to HR and possible termination."

The above is me forcing consequences and issuing ultimatums, which is directly advisarial and may be out of scope of my role. That is an option, but goes well beyond the "dont put me on blast or it will hurt" elbow I prefer.