Giving admin rights

S

SecretCharacter

I have a windows nt command script which will allow me to give admin rights
to user on specific computer. But prior to executing the script i have to
manually edit the script so that the computer name of the computer and
username of the user i wanna give admin rights to is in the script. Is there
a way I can include in the script such that when i execute it in command
prompt it will ask me to key in the user name then 'enter' then ask me to
key in computer name.
 
J

Jerold Schulman

I have a windows nt command script which will allow me to give admin rights
to user on specific computer. But prior to executing the script i have to
manually edit the script so that the computer name of the computer and
username of the user i wanna give admin rights to is in the script. Is there
a way I can include in the script such that when i execute it in command
prompt it will ask me to key in the user name then 'enter' then ask me to
key in computer name.
The easies way is to pass parameters.

If your script was named makeadmin.bat, you could:

makeadmin "username" "computername"

In the script, you would:

@echo off
if {%2}=={} @echo Syntax: MakeAdmin "UserName" "ComputerName"&goto :EOF
setlocal
set user=%1
set computer=%2
.....
,.,,
'


Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
 
S

SecretCharacter

Hi,
Thanks for the idea, that is what i am doing all the while(passing
parameters). Because of the need to map C: of the user's system before we
can give rights we will need to key in our admin account username and
password so that we can map the c: of the user's system. So it will be best
if i can do this.

Dos prompt

c:\>makeadmin
Key in username:***** (admin account for mapping c: of user's
computer) <Press Enter>
Key in password:***** (password of admin account) <Press Enter>
Key in username:****** (username to be given admin rights) <Press
Enter>
Key in computername:****** (computername of system that the user is going
 
G

Guest

Is this of any help?

@echo off
for /l %%i in (1,1,11) do echo.
set /p username=Enter Username:
cls
:retry
for /l %%i in (1,1,11) do echo.
set /p password=Enter Password:
cls
for /l %%i in (1,1,11) do echo.
set /p password1=Enter Password Again:
cls
if %password% NEQ %password1% echo THE PASSWORDS DIDN'T MATCH - PLEASE TRY
AGAIN && goto retry
for /l %%i in (1,1,11) do echo.
set /p computername=Enter Computer Name:
cls
exit
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top