Batch File Adds/Removes Machine Accounts in Server ManagerLast reviewed: March 26, 1997Article ID: Q140387 |
The information in this article applies to:
SUMMARYAn Windows NT network administrator may have to add a large number of Windows NT Workstations or Non-Domain Controller Servers to a domain's Machine Account database, which is accessed and maintained by the Server Manager user interface.
MORE INFORMATIONIn situations where a network administrator is setting up a network with a large number of new machine accounts, it may be advantageous to consider using a simple batch file to add all of the new machine accounts. It is possible to add machine accounts with a command line utility under Windows NT called NET COMPUTER. Its syntax is:
NET COMPUTER \\computername [/ADD | /DELETE] Using NET COMPUTER Command in a Simple Batch FileThis example adds 5 new machine accounts to the domain:
echo ***** Are you sure you want to add these accounts? ******* echo *** If not, press CTRL-C to terminate this batch file *** pause net computer \\NT1 /ADD net computer \\NT2 /ADD net computer \\NT3 /ADD net computer \\NT4 /ADD net computer \\NT5 /ADD cls echo ******* Machine Accounts Added ******** pauseNOTE: The NET COMPUTER command listed in this article can only be used to add Windows NT Workstation or Windows NT Server (Non-Domain Controller role) machine accounts to the Server Manager's database. Also, this command or batch files that use this command should only be run at the Primary Domain Controller(PDC). Once the batch file is run the administrator can then synchronize the account database with the rest of the domain's Backup Domain Controller's (BDC's).
Using the FOR Batch File Command in Conjunction with NET COMPUTERAnother way to accomplish this is to use the FOR command. The batch file command FOR lets your batch file repeat a command for a specific set of files. In this case, for the specific machine names we want to add to the Server Manager database:
echo ***** Are you sure you want to add these accounts? ******* echo *** If not, press CTRL-C to terminate this batch file *** pause FOR %%X IN (NT1 NT2 NT3 NT4 NT5) DO NET COMPUTER \\%%X /ADD FOR %%X IN (NT6 NT7 NT8 NT9 NT10) DO NET COMPUTER \\%%X /ADD cls echo ******* Machine Accounts Added ******** pauseNOTE: Under Windows NT, the command line is limited to 256 characters.
NET COMPUTER Errors
Using NET COMPUTER to Delete Many Machine AccountsYou can also remove many accounts by using the "\DEL" switch instead of the "\ADD" switch in the batch files shown above.
|
Additional query words: prodnt
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |