Admin privileges in batch script

MPREv

New member
Member
VIP
Local time
10:46 AM
Messages
136
Hallo,

I wrote a Script that uninstalls an application, move some files and install an Application.
The Script is working if I start it as Admin (right click - run as Admin ...).
Everything works fine.

But I want to have it working without the "run as".
The script is only used in a separated Test system,
so there is no problem if the Admin user name and password is in the script.
(also link wouldn't work, should also work if it moves to another station within the test domain)

Is there a way to manage that?
 

My Computer

OS
Windows 7
Batch command runas with a standard trick
echo password | runas
it is NOT going to work, because the password should be entered manually.

If you do not mind clicking Yes in UAC window you can use Elevate.exe
With it you won't need writing password anywhere
"C:\yourFOLDER\elevate.exe" "C:\yourScriptFOLDER\yourScript.bat"
would be enough to start script with admin privileges (still need to click YES on UAC window).
 

My Computer

Computer type
PC/Desktop
OS
Windows 8.1 ; Windows 7 x86 (Dec2008-Jan2013)
Other Info
"The scale icon at the top right of a post or tutorial is how you can give rep to the member."
The goal would be that no user have to enter (password) or click anything(UAC).
So that the batch can be executed remote or time triggered without any further interaction.

Batch command runas with a standard trick
echo password | runas
it is NOT going to work, because the password should be entered manually.
Would be fine if something like this would work.
 

My Computer

OS
Windows 7
Using PsExec utility by Sysinternals/Microsoft you can start programs over network, you can specify user, password and even start programs as a System account.
 

My Computer

Computer type
PC/Desktop
OS
Windows 8.1 ; Windows 7 x86 (Dec2008-Jan2013)
Other Info
"The scale icon at the top right of a post or tutorial is how you can give rep to the member."
Using PsExec utility by Sysinternals/Microsoft you can start programs over network, you can specify user, password and even start programs as a System account.
Yes, but if I can not pase the privileges this way?
Thats the Problem.
 

My Computer

OS
Windows 7
Yes, but if I can not pase the privileges this way?<br />
Thats the Problem.
What do you mean? Can you please be more descriptive about problem with privileges?
 

My Computer

Computer type
PC/Desktop
OS
Windows 8.1 ; Windows 7 x86 (Dec2008-Jan2013)
Other Info
"The scale icon at the top right of a post or tutorial is how you can give rep to the member."
Yes, but if I can not pase the privileges this way?<br />
Thats the Problem.
What do you mean? Can you please be more descriptive about problem with privileges?

This would work if I start it remote via PsExec.
But if this is not possible ...

For Example if a user should start it, another program, time triggered.
 

My Computer

OS
Windows 7
Back
Top