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
MPREv

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
Neutron16

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
MPREv

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
Neutron16

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
MPREv

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
Neutron16

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
MPREv

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
Thread Forum
Admin. Privileges?
I got a free computer via a local "Help" disability program (yeah me!) However, things are very different on this system (Win 7) than my old one (I have background from DOS 3.1 - Win XP). I don't know if I'm looking at Win 7 issues or something the computer providers set up (will call when I see...
General Discussion
WinUpdate made Admin act as no admin privileges available?
So, for the second time this month:sarc:, a Windows Update has basically killed my machine. As I was going to bed at 0230GMT, WindowsUpdate started an auto-install and rebooted my machine. As I logged into the Admin-level account normally, it appears to stop loading any of my programs -...
Windows Updates & Activation
Batch file requests privileges
Greetings, I have a batch file created under the administrator account. The file is in the registry to "runonce". For a user with no password, the batch file runs fine. For a user with a password, the batch file requests the user's password that is logged on. Any idea why this happens? I...
General Discussion
Saying I don't have admin privileges...
I was trying to install a video game called Phantasy Star Online: Blue Burst on my computer. It couldn't install 2 executable's saying access was denied. I have it installed on my win7 laptop so I thought I would just copy the files. Once it got near the end it said I need administrative...
General Discussion
admin privileges
hi im trying to copy and paste a file but when i try and paste it i get the you need admin privileges but i am the admin, i have turned off the UAC and ive done the take ownership thing, in fact i think i downloaded something so ive always got the take ownership option in the folder options but it...
General Discussion
Admin acount no longer has admin privileges?
Hi. The main (and only account) I have been using since the first beta came out had administrator privileges. Today when I booted up I noticed that my account could no longer do things that are associated with an admin account, such as installing certain programs and writing to certain...
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 15:23.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App