Novell Home

Reset the Password on a Local User (winnt/win2000)

Novell Cool Solutions: Trench
By Stefan Eriksson

Digg This - Slashdot This

Posted: 2 Aug 2002
 

I use this batch to reset the local administrator password or to create a new local admin user.

Create a simple application with cdm.exe as the application and /C\\yourserver\data\zenapps\adminchk.bat as the parameters. Then associate the app with a group or a container.

@echo Adminchk.bat
@echo Stefan Eriksson, 2002-02-10
@echo sen@se.schneider-electric.com
@echo Schneider Electric AB
@echo.
@echo off
rem
rem
rem Check if there is an administrator account on the local machine.
rem If the local administrator account is found, set the new password.
rem If no administrator account is found, jump to the add section.
rem
net user >c:\result.txt
find /i "newadmin" c:\result.txt
if errorlevel=1 goto add
net user newadmin password
goto cleanup

:add
rem
rem Create the administrator account and add to administrators group.
rem
net user newadmin password /add
net localgroup Administrators newadmin /add

:cleanup
rem
rem clean up and close
rem
del c:\result.txt
exit NULL

If you have any questions you may contact Stefan at sen@se.schneider-electric.com

Other Suggestions

Art Flores

Wanted to make a suggestion to anyone that might want to use the batch file in this article. To prevent anyone from reading your batch file source code, use this free utility called "BAT2EXEC v1.5 - Freeware BAT 2 EXE converter". After converting your .bat to an .exe file, you can use your program without anyone being able to read your code, keeping your passwords private and unknown to end users.

Download bat2ex15.zip

If you have any questions you may contact Art at Art.Flores@cs.oag.state.tx.us


Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© 2014 Novell