Downloads
5458.zip

Do you have a scripting-related question or problem? You can send your question or problem to win32sj@winntmag.com.

I want to write Perl scripts. Where can I obtain ActivePerl?

You can obtain Perl for Win32, or ActivePerl, from the ActiveState Tool Web site. Go to http://www.activestate.com, and click Check here first under the ActivePerl build 515 heading. (The 515 build number might change if a newer release is available.) On the page that appears, click Get ActivePerl 515 NOW! Download the appropriate Intel (APi515e.exe) or Alpha (APa515e.exe) self-installing archive. After the download is complete, install ActivePerl by running the executable you downloaded.

I need to produce a report that shows the last logon date for every user on a specified domain. I know that you can use the Windows NT Net User command to specify the last logon date for a user. Can I use this command in a Perl script to automate the task of obtaining every user's last logon date?

As Listing 1 shows, you can use the Net User command in a Perl for Win32, or ActivePerl, script. The lstlgn.pl script in Listing 1 generates the lstlgn.txt report, which lists all domain user accounts and corresponding last logon information.

You run the lstlgn.pl script from a command prompt by typing

C:\> perl lstlgn.pl

For more information about using NT commands in Perl scripts, see Bob Wells' Windows NT Magazine Scripting Solutions article "Commanding NT's Command Line" (May 1998).