\[Editor's Note: Share your scripting discoveries, comments, problems, solutions, and experiences with products. Email your contributions (500 words or less) to [email protected] We edit submissions for style, grammar, and length. If we print your submission, you'll get $100.\]
When I read the Windows & .NET Magazine Reader to Reader: "User Manager Shortcuts" (September 2001, http://www.winnetmag.com, InstantDoc ID 21664), I realized that other administrators would benefit from the Perl script I wrote to automatically create shortcuts for User Manager, Server Manager, Windows NT Event Viewer, and other administrative utilities. A coworker and I support 160 Windows 2000 and NT servers, and we like to have quick access to our servers and domains. Shortcuts.pl, which Web Listing 1 (http://www.winscriptingsolutions.com, InstantDoc ID 38668) shows, creates a directory called AdminUtilities on your desktop, with subdirectories comprised of administrative shortcuts for every server and domain you manage. The script has two command-line options: one for a text file that contains a list of your servers (i.e., f=servers.txt) and one for one or more servers (i.e., s=server01 or s=server01,server02,server03). The script requires Lanman 1.0.9 or later.
I share my script with other administrators in the company. Because I don't know which servers and domains each administrator supports, the script takes an administrator's list of servers and determines which servers are domain controllers (DCs), determines the DCs' associated domains, and creates an appropriate shortcut based on the type of server. (You need administrative rights on the servers for the script to be able to make the determination.) For example, a User Manager shortcut doesn't belong in a DC directory but does belong in a domain directory or a member server directory. In the script's InitializeUtilities subroutine, the first element of each array in the Utilities hash determines whether a shortcut should be created for each utility, based on the server type. For example, defining the Server Manager shortcut as Server/DC/Domain signifies that the Server Manager shortcut will be created for a member server, DC, and domain; defining the User Manager shortcut as Server/Domain signifies that the User Manager shortcut will be created only for a member server and domain. (To connect to Win2K servers, use NT 4.0's usrmgr.exe. Win2K's version can't manage Win2K domains, but you can use NT 4.0's version to manage the local user accounts on a Win2K server.) Figure 1 shows sample output for Shortcuts.pl.
As you can see from the list of utilities, I like to use Sysinternals' PsTools suite (available at http://www.sysinternals.com/ntw2k/freeware/pstools.shtml). For simplicity, copy all the utilities to a common directory on your workstation (e.g., C:\tools). To change the location of the AdminUtilities directory and the utilities directory, simply change the two variables. If you want to create additional shortcuts, follow the examples and add utilities to the Utilities hash in the InitializeUtilities subroutine.