Giving admin rights

  • Thread starter Thread starter SecretCharacter
  • Start date Start date
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.
 
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
 
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
 
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
 
Back
Top