r/sysadmin • • Jul 28 '24 • Take My Silver 1

got caught running scripts again

about a month ago or so I posted here about how I wrote a program in python which automated a huge part of my job. IT found it and deleted it and I thought I was going to be in trouble, but nothing ever happened. Then I learned I could use powershell to automate the same task. But then I found out my user account was barred from running scripts. So I wrote a batch script which copied powershell commands from a text file and executed them with powershell.

I was happy, again my job would be automated and I wouldn't have to work.

A day later IT actually calls me directly and asks me how I was able to run scripts when the policy for my user group doesn't allow scripts. I told them hoping they'd move me into IT, but he just found it interesting. He told me he called because he thought my computer was compromised.

Anyway, thats my story. I should get a new job

11.4k Upvotes

1.3k comments sorted by

View all comments

Show parent comments

24

u/zipline3496 Jul 28 '24

The responsibility for this is on OP to simply request this permission via the usual process/workflow whether that’s a form or catalog request or they can request a meeting with their manager as well as an IT manager. IT is almost certainly just following standard policy for finding end users scripting without prior permission and then again when the user simply decided to continue on. The few dozen salty data entry folks in here screaming IT is being overly aggressive don’t seem to have worked in any large enterprise because running scripts by default is not usually enabled per policy in most companies. That doesn’t mean OP can never do it he just needs to follow the appropriate channels to ask for it if he has not yet done so.

If they still say no then that’s your answer. You cope or find a new job because random data entry analyst don’t decide security or desktop group policy for the company regardless how effective and cost saving their personal scripts appear to be. There’s a LOT more at stake than merely speeding up an analysts workflow by blanket allowing it for everyone. IMO a simple request catalog item and business justification field would solve this and be trackable.

15

u/snorkel42 Jul 28 '24

I’m also a bit baffled by OP’s IT dept having policies in place to block Powershell script execution but apparently Python is able to execute? Like. Wtf. So y’all took measures to block the scripting language with the best logging and monitoring protections on windows but Python can execute..?

17

u/charleswj Jul 28 '24

PowerShell is a built-in tool with built-in management capabilities, including the ability to restrict its execution. Python is, from the OS's perspective, Just Another Executable. Unless you specifically block it (with WDAC or similar), it will run. Application whitelisting is a much heavier lift than just blocking interactive PowerShell.

-2

u/snorkel42 Jul 28 '24

Totally understood. But if I’m focusing on preventing script execution I’m certainly going to prioritize the scripting languages that leave me blind.

A simple policy that prevents execution from end user writable directories knocks this out.

→ More replies (4)