Select to view content in your preferred language

Specific Windows 10 permissions to run .py script when user not logged in

9064
14
02-24-2017 10:47 AM
Lake_Worth_BeachAdmin
Regular Contributor

I have a script (.py) to perform SDE Maintenance that I want to run after work hours (say 2am). I can execute the script fine manually and it works. 

I set a task schedule job to run this script when my user account is not logged on (because it will be 2am, who the heck wants to be at work at 2am). It is important to run this script after hours because it will disconnect all users from the SDE. 

Windows Task Scheduler History says the task has ran successfully but the script is not ran and the SDE Maintenance is not performed. I had IT temporarily give me Admin rights and then everything worked as it should.

However our Network Admin will not grant me Admin rights permanently.... and he is having difficulty finding the exact permissions to grant me in order for this to run successfully. 

Does anyone know what group policy/user privileges will have this work without granting my user full Admin rights?

Or are there any workarounds for this? 

Thanks for any help,

Joe 

14 Replies
Lake_Worth_BeachAdmin
Regular Contributor

Still the same when added the quotes to both fields. 

0 Kudos
ScottFierro2
Regular Contributor

OK, so I found an old example out on a DEV server and have screenshots of all the tabs where we had used direct python call instead of running a batch file. You can check these for any variances but it seems like that double quotes issue would have been it. Given that the script runs fine in your IDLE but fails from Task Scheduler then if all your settings are similar to what's below and nothing stands out that fits a permissions issue I would have to lean towards your AD account lacks the permissions to run the python executable itself. Process of elimination dictates that the script works and you can execute the script from the IDLE and if your Task Scheduler is configured right then the only missing link between these is how Task Scheduler calls the Python executable to run the script.

Lake_Worth_BeachAdmin
Regular Contributor

Ok great thanks this is a huge help, I am running windows 10 on my work desktop so I have changed the default "configure for" to windows 10.... but since the script will be running on a windows sql server (2008 or 2012 I forget) is that  issue? I figured it was regarding what the host OS is using not what the program/script will be executing on. 

ScottFierro2
Regular Contributor

That's right it's all about the local host executing the task not where the script is doing work at. All that work you covered within the script itself. So the permissions issue seems to be your AD account having the local desktop permissions to execute python.exe which your Network or System Admin should be able to allow those permissions and limit to just that executable.

Lake_Worth_BeachAdmin
Regular Contributor

Thank you Scott,

you provided much assistance with this I will provide what the outcome is once I get my SysAdmin to make some changes. 

0 Kudos