NTAdmin Tool Set and Intranet Site


Prepared by James Leeds Jr. May 11, 2001
Modified by James Leeds Jr. May 7, 2002

Introduction

Download the site structure here.

The tone of this document is fairly informal, as the intranet site and associated Perl scripts are all in beta, and will probably stay there forever. The NTAdmin tool set is not intended to be commercial-quality software; rather, it is designed to be as easily modified to add new functions as possible.

Please know that I did not write all the scripts used here.  Ivan Lim wrote a number of them, and the Drive Space script is originally by Paul Popour.  I do not represent them as being all mine.  Feel free to modify any scripts as needed to make them work better in your environment.

It is assumed that the reader has some level of familiarity with IIS and Perl. If either of these assumptions is not true, do not read any further. Find some IIS documentation at www.microsoft.com, and read some Perl books. Plenty of good ones can be found at perl.oreilly.com, including Learning Perl on Win32 Systems, Programming Perl, and the Perl Cookbook. The two Win32-specific books by Dave Roth can be found at www.roth.net: Win32 Perl Programming: Standard Extensions and Win32 Perl Scripting: The Administrator's Handbook. Also helpful would be Lincoln Stein’s Official Guide to Programming with CGI.pm. These are all invaluable if you intend to support this site long-term.  Check out my bookshelf page if you’d like to see what else I find useful.

System Requirements

The majority of the NTAdmin tool set is written in Perl. It has been stable on IIS4, running on Windows NT 4, under service packs 4, 5, or 6. The web portions have also worked properly on Windows NT Terminal Server Edition, service pack 6. Some of the scripts require that ADSI be installed on the server. The current ADSI version is 2.5. The automated scripts have not worked reliably on Terminal Server Edition up to this point. The only supported client browser is IE, either version 4 or 5. Netscape and other browsers may work for portions of the site; however, secured portions will mostly not be accessible.

The scripts will run under ActiveState ActivePerl Build 516. Changing to another build will probably require that scripts be rewritten to some extent. It will also probably require new versions of many of the installed modules.

The following Perl modules are installed: Win32-AdminMisc (version 19990405, available at www.roth.net), Win32-NetAdmin (version 0.06, from ActiveState), Win32-LanMan (version 1.0.9.2, downloaded from CPAN, I believe), Win32-EventLog (version 0.062, from ActiveState), Date-Calc (version 4.3, from CPAN), Spreadsheet-WriteExcel (version 0.31, from CPAN), Parse-RecDescent (version 1.80, from CPAN, required by Spreadsheet-WriteExcel) and CGI (version 2.46, available at stein.cshl.org). These are in addition to the modules that are part of the standard installation.

I run the scheduled tasks using AutoTask Scheduler. This allows them to be run in a particular user context, and is more powerful and reliable than either AT or Task Scheduler.  I’m sure other schedulers can be made to work.

General design of the NTAdmin tool set

Most of the files in the NTAdmin tool set are located in the inetpub directory, in the subdirectory NTAdmin. There are multiple subdirectories below NTAdmin, including Archives, exe, batch.rpt, MDL, Query, PasswordReset, and Printers. Outside of the NTAdmin directory, there is also a default.html file in the wwwroot subdirectory, as well as the Phone and DutyPager directories.

The NTAdmin directory is set up in IIS as a virtual directory beneath the root directory. There is also a virtual directory kb configured to point at \\bhratlfsg01\division$\xc\knwledge base; if the knowledge base is moved, the virtual directory will need to be reconfigured to point to the new location. When the SOP Manual is finished, a link will be provided from the default.html home page.

Scheduled tasks and scripts

There are a number of scripts in the exe directory that run on a scheduled basis. The perl scripts have been wrapped into CMD scripts. The primary CMD scripts and their functions are as follows:

CRON-PERL-2.CMD dumps event logs from Exchange servers at 5AM

CRON-PERL-3.CMD dumps other event logs, server uptime poll at 5:30AM

SRVDRVSPACE.CMD checks drive space on all servers at 5:30AM

The scripts run by the first three CMD scripts all get the list of servers to run against from SERVERS2POLL.INI. The exact format for entries in this file is documented within the INI file itself.

Generally, these scripts are performing tasks that require administrator level access. I have them configured to run using the NAIAntivirus account. While that account is not specifically designed for this, it does have appropriate access to the servers, and this eliminates password expiration and account lockout issues.

There are also a number of scripts located in the SCRIPTS directory on the D drive. These are not all Perl-based. Some are run as scheduled tasks:

COPYPERLSCRIPTS.BAT copies any Perl scripts in my H drive that have changed using ROBOCOPY

SECLOGDUMP2.PL located in the PERL subdirectory; dumps the security logs of all the PDCs

Both are run using an account with domain admin privileges.

Morning Report Information

The scheduled CMD scripts generate HTML output (server uptime report), a text file (drive space report), Excel spreadsheets (event log dumps), or CSV files (ArcServe log parser). The reports are placed in the batch.rpt directory; the drive space report output is placed in the batch.rpt\drvspace subdirectory. Every Monday, the oldest week of reports in the primary directory should be manually moved to the archive subdirectory. When the security log dumps are burned to CD every quarter, the quarter’s reports are also burned to that CD.

The batch.rpt directory is reachable through the link on the Intranet home page labeled “Morning Report Information”. The link points to an ASP page that lists all files which have names matching the patterns used by the scripts when generating output files.

Queries

The Query directory contains the following web pages:

User Login Query

Group Member Query

There are multiple versions located here. Generally the highest version is in beta, and is listed under “Beta Tools” on the home page. The next highest version is production, and is linked to under “General Tools”. There may also be older versions here; at the present time there is no official archive location. The current production version of the User Login Query is 9, and the Group Member Query is at version 10.

These scripts all run acceptably as the anonymous IUSR account at the present time, so anonymous access is enabled in IIS. The IUSR account must have read access to the directory. This is to allow the help desk to use these queries. If the help desk logged into a trusted domain, NT Challenge/Response could be used instead.

Password Reset

There are now two web pages located in this directory:

PasswordReset5.pl

AccountReset1.pl

The directory is configured in IIS with basic authentication only enabled. This allows the scripts to run in the context of the user. The user in question must have the right to change passwords (Account Operator or Administrator level access). Access is limited to certain local groups: XC Onsite, XC LAN Admins, BHR LAN Admins, and XC Help Desk.

Printers

The Print Queue Query has moved into quasi-production. The current version is:

PrintQueueQuery7.pl

The directory is configured in IIS with basic authentication only enabled. The following groups have been given NTFS rights: XC Onsite, XC LAN Admins, and XC Help Desk. The page allows viewing of all print jobs in all queues on a given print server. Note that “print server” in this case includes the Citrix servers. Future plans include details of print jobs, and possibly print queue management.

This is one of the scripts that requires ADSI.

MDL

This directory is for spreadsheet exports from the MDL. Another of the planned improvements to the XCADM site is a web-enabled front end for the MDL database. Until that time, these exports must be updated manually. Authentication is set to NT Challenge/Response, and access is limited to certain local groups: BHR LAN Admins, BHR MDL Access, XC Help Desk, XC LAN Admins, and XC Onsite.

DrvSpaceCharts

These charts are manually created in Excel using the historic data generated by the Drive Space script. (The historic data is located in batch.rpt\drvspace, and is in the form servername_drive letter.txt.) These are static reports.

Archives

This directory is for the older scripts that are no longer in production. Also, old versions of the MDL exports are here. There are subdirectories for MDL, PasswordReset, and Query. The older logon query tool, (the file is named querynumofloginsforuser10.asp) is also located in the Query directory. This version is depreciated, and its use is not encouraged – there is no longer a link to it from the home page. It is mostly kept here in case the code might be useful for future upgrades to the newer version.

Future Plans

While I’d like to indicate where it’s going next, I don’t really know. I’d like to work up a web front end for the MDL, using DBI. And I’d like to link the logon query and the password reset and account unlock pages. Excel output for the drive space reports would be nice. And I’m working in my copious spare time to improve the event log dumps…

Other Links

There are a number of other links on the Intranet home page. These are to various Six Continents Intranet and Internet sites, Xerox Connect Internet sites, and other useful sites. As these are simply links, documentation of the sites themselves is outside the scope of this document.