UNCLASSIFIED Thank you both for the great script to do this.
I was doing it the long way, querying each DC, and getting the last logon time of each user. Where can I find more information on different methods/properties like you used in the script? -----Original Message----- From: Tim Dumas [mailto:[EMAIL PROTECTED] Sent: Thursday, June 12, 2003 2:00 PM To: 'Leon'; 'Tillman, James'; 'Robert-Jan Mora' Cc: 'perl'; 'win32'; 'Yahoo Beginner Perl' Subject: RE: Last Logon of ALL users in the domain If you want the Time of logon along with the date you can use this modified version. use Win32::OLE; use Win32::OLE::Variant; use Win32::OLE::NLS qw(:LOCALE :DATE); my $domain = Win32::OLE->GetObject("WinNT://DomainHere"); foreach my $object (in $domain) { if ($object->{Class} eq 'User') { my $last_login; if ($object->{LastLogin}) { $last_login_date = $object->{LastLogin}->Date(DATE_LONGDATE); $last_login_time = $object->{LastLogin}->Time(); }else { $last_login_date = "Unknown"; $last_login_time = "Unknown"; } print $object->{Name} . "=" . $last_login_date . " " . $last_login_time ."\n"; } } Tim Dumas -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Leon Sent: Thursday, June 12, 2003 12:03 PM To: Tillman, James; Robert-Jan Mora Cc: perl; win32; Yahoo Beginner Perl Subject: RE: Last Logon of ALL users in the domain This totally 100 percent worked. Thank you so much!!!! "Tillman, James" <[EMAIL PROTECTED]> wrote: This works on my own domain from a Win2k or NT box: use Win32::OLE; use Win32::OLE::Variant; use Win32::OLE::NLS qw(:LOCALE :DATE); my $domain = Win32::OLE->GetObject("WinNT://IRM-NT"); foreach my $object (in $domain) { if ($object->{Class} eq 'User') { my $last_login; if ($object->{LastLogin}) { $last_login = $object->{LastLogin}->Date(DATE_LONGDATE) } else { $last_login = "Unknown"; } print $object->{Name} . "=" . $last_login . "\n" } } Just a thought... jpt -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
