Obtaining and Installing Perl for Win32's AdminMisc Extension One attractive aspect of the Perl language is the large number of add-on modules available. These add-on modules are collections, or libraries, of additional functions that you can download for free on the Internet. Corporate and independent developers developed these modules and contributed them to the Perl community. You can usually find the modules at http://www.perl.com, which is the Web site of Comprehensive Perl Archive Network (CPAN).

You can also find modules at the Web sites of the developers who created them. For example, Dave Roth developed AdminMisc to address deficiencies in the NetAdmin module. (NetAdmin is part of the standard Perl for Win32 distribution.) Table A lists all the functions in AdminMisc. You can download the AdminMisc module from Roth’s Web site at http://www.roth.net/perl/adminmisc.

Downloading and installing extensions is simple. The potential snag is making sure you fetch the appropriate type and version based on the distribution and version of Perl you’re running. Let me explain. Two primary Perl distributions are available for the Win32 platform: core and ActiveState. First, you want to make sure you retrieve the extension that’s appropriate for your Perl distribution. For example, I’m running ActiveState’s Perl for Win32 so I need the ActiveState build, not the core build. Second, you need to make sure the extension supports the specific version of Perl you’re using. For example, my ActiveState version is 5.003_07, build 316, so I need to look for the corresponding extension version. However, the extensions and Perl versions don’t always have to match. A good rule of thumb is the closer the version numbers, the better. The developer usually provides instructions telling you which version you’ll need.

The following steps guide you through the download and install process for the AdminMisc extension appropriate for ActiveState’s Perl for Win32, version 5.003_07, build 316. Here are the nine steps:

  1. Using your favorite browser, go to http://www.roth.net/perl/adminmisc.
  2. From the Win32::AdminMisc FAQ Web page, click the Go and get it! link.
  3. Download AdminMisc_Build_311.zip (located in the bin/ subdirectory) to an empty temporary directory. If you're using the core distribution, download AdminMisc_Build_CORE.zip and follow the instructions included in readme.
  4. Unzip AdminMisc_Build_311.zip in the temporary directory. The archive will contain four files: AdminMisc_311.pll, adminmisc.pm, readme, and test.pl.
  5. Rename AdminMisc_311.pll to AdminMisc.pll.
  6. In the ActiveState Perl for Win32 directory drive:\Perl\lib\Auto\Win32\, create a new directory, calling it AdminMisc.
  7. Copy AdminMisc.pll to the newly created drive:\Perl\lib\Auto\Win32\AdminMisc\ directory.
  8. Copy AdminMisc.pm to the drive:\Perl\lib\Win32\ directory.
  9. Test your installation by running: c:\> perl test.pl.

If this procedure is unacceptable, you'll be glad to hear that ActiveState Tool and O’Reilly & Associates are developing a Perl for Win32 Resource Kit that will address this and several other Perl for Win32 nuances. I will review the Perl for Win32 Resource Kit in a future column.

TABLE A: AdminMisc Functions
CreateProcessAsUser GetEnvVar GetStdHandle ScheduleDel
DNSCache GetFileInfo GetTOD ScheduleList
DNSCacheSize Gethostbyaddr GetWinVersion ScheduleList
DNSCacheCount gethostbyname LogonAsUser UserCheckPassword
ExitWindows GetHostAddress LogoffAsUser UserChangePassword
GetComputerName GetHostName ReadINI UserGetAttributes
GetDC GetIDInfo RenameUser UserGetMiscAttributes
GetDriveGeometry GetLogonName SetComputerName UserSetAttributes
GetDrives GetMemoryInfo SetEnvVar UserSetMiscAttributes
GetDriveSpace GetProcessorInfo SetPassword WriteINI
GetDriveType GetPDC ScheduleAdd