Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Is there a way to run a powershell script automatically in Elevated mode?

I am trying to automate some post-image tasks without user intervention, but am getting caught with the UAC. Is there a way to "bypass" this, possibly by running as another user?

I want the machine to reboot and run various scripts, so it can complete the build process with no intervention.



share|improve this question

2 Answers 2

Startup scripts run with elevated privilege can you add your script to the Startup scripts in Computer Configuration-Windows Settings-Scripts(startup/Shutdown)?

I'm sure there are other ways to pass credentials but this has worked for me in the past

share|improve this answer
Is there a way to programatically add a script to the local startup scripts folder? Say I have 3 scripts to run - coul I add a line in script A to copy script B to the startup script folder and delete script A and then add a line in Script B to copy script C to the scripts folder and delete Script B? – Ben Jun 24 '10 at 13:24
can you expand on this? Have added it in there, but it doesn't want to play. :-( – Ben Jun 24 '10 at 15:51
Are there any errors in the event log? Where is the file loacated? – Dave M Jun 24 '10 at 18:54
File is located in c:\windows\system32\grouppolicy\machine\scripts\startup (computer is back at the office so will check the log tomorrow) - Thanks, Dave. Ben – Ben Jun 24 '10 at 19:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.