How do you run a script as administrator (have local admin access)

Red Squirrel

No Lifer
May 24, 2003
70,182
13,576
126
www.anyf.ca
I want to run a script on startup on a windows 7 machine but it requires admin rights. The account has local admin access but when you run a script it does not seem to run as admin. You can launch the script manually "as administrator" by right clicking it but I need to automate it.

How do I go about doing that?
 

Red Squirrel

No Lifer
May 24, 2003
70,182
13,576
126
www.anyf.ca
Ok figured something out, decided to just run it as a scheduled task with a 30 minute delay and it seems to work fine and run as admin.
 

Micrornd

Golden Member
Mar 2, 2013
1,341
221
106
I want to run a script on startup on a windows 7 machine but it requires admin rights. The account has local admin access but when you run a script it does not seem to run as admin. You can launch the script manually "as administrator" by right clicking it but I need to automate it.

How do I go about doing that?
gpedit.msc
computer configuration
windows settings
scripts
startup
 

Ajay

Lifer
Jan 8, 2001
16,094
8,112
136
Ok figured something out, decided to just run it as a scheduled task with a 30 minute delay and it seems to work fine and run as admin.

Please tell me you had to login as an admin to do that. Effing Winders default allow dangerous shit.
 

Red Squirrel

No Lifer
May 24, 2003
70,182
13,576
126
www.anyf.ca
Please tell me you had to login as an admin to do that. Effing Winders default allow dangerous shit.

No just as my regular domain user, but that user has local admin access. I presume it would not allow me to run task as admin otherwise... then again, it's windows lol.
 
  • Like
Reactions: Ajay

Ajay

Lifer
Jan 8, 2001
16,094
8,112
136
Yeah thanks, I feel better now. My brother and I figured out how to push some tasks like that out using one of the pstools, but that was like a decade ago running as domain admin.