Avatar of IT-CICA
Flag for Canada asked on

Run a program as administrator using .BAT file


I have a SSIS package in which one of the steps is Execute Task -> execute a .BAT file and launch a program (Street sweeper).

The package runs successfully when run through Visual studio. The program runs fine when only the .BAT file is run.

But a job that executes this package, it gets stuck at this .BAT file step because the program needs to be run as administrator. (There is no 'Run as Admin' check box on the properties of .BAT file) I created a shortcut to this file, configured the shortcut to always run as admin, but the SSIS package's job still fails at this step.
I need to come up with something to always run this program as administrator through the BAT file.

Any workarounds to this?

Thanks in advance!
Microsoft SQL Server 2008

Avatar of undefined
Last Comment

8/22/2022 - Mon

Try this by adding the below line in your batch file:

runas /user:REQUIREDUSERNAME /savecred filenamewithfullpath

Another way is to install the program in c:\

That would avoid needing Administrator rights in \program files when batch file is ran

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes