PDA

View Full Version : running batch files as admin


Gary
February 8th 04, 03:42 AM
I would like to run batch files to change system settings
like tcp/ip settings. These changes required admin rights
but I would like it to run them with the admin password
included in the batch file. I do not want to have to login
as admin and also would like to have these batch files
available without having to give out the admin password.
Any ideas? Thanks!

Doug Knox MS-MVP
February 8th 04, 05:24 AM
As long as you're using the RUNAS command, you will have to ensure that =
you use the ECHO OFF command as the first parameter of any BAT file, to =
prevent the user from seeing the password. You will also need to make =
sure that the user (or their group) does not have read access to the =
folder the BAT file is located in.

You may be able to launch the BAT file from a VB Script. Scripts can be =
encoded using the VB Script Encoder. Documentation for the scripting =
language and downloads for the VB Script Encoder can be found at:

http://msdn.microsoft.com/scripting

--=20
Doug Knox, MS-MVP Windows XP/ Windows Smart Display
Win 95/98/Me/XP Tweaks and Fixes
http://www.dougknox.com
--------------------------------
Per user Group Policy Restrictions for XP Home and XP Pro
http://www.dougknox.com/xp/utils/xp_securityconsole.htm
--------------------------------
Please reply only to the newsgroup so all may benefit.
Unsolicited e-mail is not answered.
=20
"Gary" > wrote in message =
...
> I would like to run batch files to change system settings=20
> like tcp/ip settings. These changes required admin rights=20
> but I would like it to run them with the admin password=20
> included in the batch file. I do not want to have to login=20
> as admin and also would like to have these batch files=20
> available without having to give out the admin password.=20
> Any ideas? Thanks!

Torgeir Bakken (MVP)
February 8th 04, 10:02 PM
Gary wrote:

> I would like to run batch files to change system settings
> like tcp/ip settings. These changes required admin rights
> but I would like it to run them with the admin password
> included in the batch file. I do not want to have to login
> as admin and also would like to have these batch files
> available without having to give out the admin password.
> Any ideas? Thanks!

Hi

You might get something to work using a Runas wrapper utility or similar,
take a look here:

http://groups.google.com/groups?selm=3FE0B42C.773CA875%40hydro.com


Also, if you give the user(s) the Network Configuration Operator rights,
they can change the tcp/ip settings without being an local administrator.

Here is a nice post of what a Network Configuration Operator can and
can't do:

http://groups.google.com/groups?selm=UTphJnbrDHA.1544%40cpmsftngxa06.phx.gb l


--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter

Google