Subscribe to Windows IT Pro
November 19, 2001 12:00 AM

Real-World Scripting: Adding a Local Group

Windows IT Pro
InstantDoc ID #23042
Rating: (0)
Downloads
23042.zip

Using PopulateGroups.bat
I've tested PopulateGroups.bat on Win2K Pro running Service Pack 2 (SP2) and NT Workstation running SP6. To use PopulateGroups.bat in your environment, you first need to download the script from the Code Library on the Windows Scripting Solutions Web site and install the Win2K or NT resource kit. The resource kit must be in the same path as the script. (If you want the resource kit in another location, you can specify that path in the script.)

Next, you need to create an input file that lists the PCs you want to test initially. Put one PC name per line, and save the PC input file as pclist.txt.

At this point, you need to customize the script for your environment. Here are the customizations:

  1. Customize the %temp% variable location, if needed. PopulateGroups .bat uses a %temp% variable that's typically a user variable. If you plan to run the script under a system account, this variable might not exist and cause the script to fail. Thus, you need to customize the line


  2. Rem Set temp=C:\temp
    

    First, uncomment the line by removing the Rem command. Then, replace C:\temp with your temporary variable location. (The location must be on the computer on which you plan to run the script.)

  3. Customize the name of the group you want to add. In the line


  4. Set Group=domain1\helpdesk
    

    replace domain1\helpdesk with your group's domain and name.

  5. Customize the location of the PC input file. In the code


  6. SetTargetlist=
    \\dom1pdc\tools\pclist.txt
    

    replace \\dom1pdc\tools\pclist.txt with the path to your PC input file.

  7. Customize the name of the log. In the code
    Set Log=
       \\dom1pdc\tools\addlog.csv

    replace \\dom1pdc\tools\addlog.csv with the path to your log.

  8. Customize the path to the rerun log that records the PCs to be tested on the next run. In the code


  9. Set Rerunlog=
       \\dom1pdc\tools\runagain.txt

    replace \\dom1pdc\tools\runagain.txt with the path to your rerun log.

  10. Customize the local Administrators accounts in the code that callouts A, B, C, and D in Listing 2 highlight. Following the syntax


  11. Net Use \\%target%\ipc$
       password
    	/user:%target%\username
    

    customize password (e.g., hello1, the 1man) and username (e.g., root, root1). You can add or delete accounts as needed.

Finally, schedule the script to run several times per day during the times when you think most of the computers will be on. After a few days of running the script, you'll have added the group to almost all the computers.

Related Content:

ARTICLE TOOLS

Comments
    There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.