Solved

batch file to create a windows user account

Posted on 2009-05-15
5
2,934 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
Comment Utility
"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 82

Expert Comment

by:oBdA
Comment Utility
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
Comment Utility
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
Comment Utility
will this work for xp and 2000 systems??
0
 
LVL 82

Accepted Solution

by:
oBdA earned 500 total points
Comment Utility
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

When you receive another warning that your shared drive is almost full and you have asked your users to clean out old files again and again, here is a single command that may help. This command will place all the files that have not been used rec…
If you have done a reformat of your hard drive and proceeded to do a successful Windows XP installation, you may notice that a choice between two operating systems when you start up the machine. Here is how to get rid of this: Click Start Clic…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now