Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.



Windows 7: Admin privileges in batch script

06 Jun 2011   #1

Windows 7
 
 
Admin privileges in batch script

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 System SpecsSystem Spec
.

06 Jun 2011   #2

Windows 8.1 ; Windows 7 x86 (Dec2008-Jan2013)
 
 

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 System SpecsSystem Spec
07 Jun 2011   #3

Windows 7
 
 

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.

Quote:
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 System SpecsSystem Spec
.


07 Jun 2011   #4

Windows 8.1 ; Windows 7 x86 (Dec2008-Jan2013)
 
 

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 System SpecsSystem Spec
07 Jun 2011   #5

Windows 7
 
 

Quote   Quote: Originally Posted by Neutron16 View Post
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 System SpecsSystem Spec
07 Jun 2011   #6

Windows 8.1 ; Windows 7 x86 (Dec2008-Jan2013)
 
 

Quote   Quote: Originally Posted by MPREv View Post
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 System SpecsSystem Spec
09 Jun 2011   #7

Windows 7
 
 

Quote   Quote: Originally Posted by Neutron16 View Post
Quote   Quote: Originally Posted by MPREv View Post
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 System SpecsSystem Spec
Reply

 Admin privileges in batch script





Thread Tools



Similar help and support threads for2: Admin privileges in batch script
Thread Forum
Admin. Privileges? General Discussion
Solved WinUpdate made Admin act as no admin privileges available? Windows Updates & Activation
Solved Batch file requests privileges General Discussion
Saying I don't have admin privileges... General Discussion
admin privileges General Discussion
Admin acount no longer has admin privileges? General Discussion

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 12:18 PM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33