Link to home
Start Free TrialLog in
Avatar of IT-CICA
IT-CICAFlag for Canada

asked on

Run a program as administrator using .BAT file

Hi

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!
Avatar of hafeezmca
hafeezmca
Flag of United Arab Emirates image

Hi,
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
ASKER CERTIFIED SOLUTION
Avatar of lcohan
lcohan
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of IT-CICA

ASKER

Thanks