computing
  • 1

Solved How To Run Python Script As Windows Administrator?

  • 1

I am using python script and win32serviceutil module in order to stop and start Windows services. I am a member of group ‘local administrators’. I login as that member and run the script but get the error: Access denied. If I start cmd prompt as Administrator and the run from that window it works fine. My question: how inside the script I could specify to run it as administrator? (note: I don’t know administrator password) Thanks

Share

1 Answer

  1. I resolved my issue by looking into one of the topics on stackoverflow.com
    It suggested to use batch file which will call python script and on the top of that batch use PowerShell command to elevate privilage.
    It worked for me.
    Ticket could be closed
    • 0