Solved

batch file to create a windows user account

Posted on 2009-05-15
5
2,950 Views
Last Modified: 2012-05-07
Hello
   I am looking to create a batch file that will create an admin user on windows xp machines in a workgroup setting.
I also need to make this user account hidden.
I would like to be able to run this once and have it update 3 -6 computers in the workgroup.

any ideas????
thanks
0
Comment
Question by:schuitkds
  • 2
  • 2
5 Comments
 
LVL 31

Expert Comment

by:Frosty555
ID: 24401523
"Microsoft Windows NT Server Resource Kit Supplement 3" comes with a command line program called "ADDUSERS", which lets you create users by specifying an input text file with informatino about the users to create.

You could write a batch file that calls this EXE.

See this webpage:
http://tech.cuip.net/logins/docs/Addusers-overview.htm
0
 
LVL 84

Expert Comment

by:oBdA
ID: 24402424
Try the script below. Note that you can NOT "hide" the account itself; you can just prevent it from showing up on the logon screen.
You can use psexec (http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx) to run this remotely on other machines (assuming those machines all have the same administrator account and password), and there's no firewall preventing remote access.
Put the computer names into a list and run this command:
psexec @"C:\Temp\Computerlist.txt" -u "Administrator" -p "Password" -c C:\Temp\CreateUser.cmd
@echo off
set UserID=JDoe
set FullName=Doe, John
set Comment=Administrative user
REM Set Password to * to be prompted, to the password otherwise; do not use < > | % & ^
set Password=*
REM Create the user:
net user "%UserID%" "%Password%" /fullname:"%FullName%" /usercomment:"%Comment%" /add
REM Add him to the Administrators group:
net localgroup "Administrators" "%UserID%" /add
REM Remove account from logon screen:
reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList" /d "%UserID%" /t REG_DWORD /v "0"

Open in new window

0
 

Author Comment

by:schuitkds
ID: 24403996
does every computer in the workgroup need the psexec on it to run this command or can i run it from one system?
0
 

Author Comment

by:schuitkds
ID: 24403998
will this work for xp and 2000 systems??
0
 
LVL 84

Accepted Solution

by:
oBdA earned 500 total points
ID: 24404309
You only need psexec on the machine on one system; that's its purpose.
The script will work for both, only the reg key will have no function in W2k.
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If like me you are one who spends a lot of time working and scripting with cmd.exe, sometimes it is handy to be able to quickly view a calendar for a given month and year. This script will quickly do just that!  Save the code posted below to a .bat …
NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

837 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question