(Msg. 1) Posted: Sun Jun 22, 2008 11:21 pm
Post subject: last login time for a user Archived from groups: microsoft>public>win2000>active_directory (more info?)
Hello,
I'm required to show last login times for a user when they login to a
server running Windows Server 2003. I'm trying to use the script at the
end of this message to query the DIT and retrieve the value of
lastLogonTimestamp for the user currently logging in. The script I'm
using is a common script that is found on many websites and the VBscript
version comes from the WIndows Server Cookbook. The problem I'm having
is that the script always returns Dec 31 1969 despite the fact that the
domain administrator account I'm querying just logged in because I'm
running the script as the domain administrator account for test purposes.
One version of the script uses subtraction on the "- $objLogon->LowPart"
but I tried that and it doesn't change the printed value.
Modifying the last 2 $intLogonTime lines at the end of the script don't
even change the printed value either. I'm not sure why this is
happening. Can anyone help? The value is being set. I verified using
ADSI Edit.
# ------ SCRIPT CONFIGURATION ------
my $strUserDN = "<UserDN>"; # e.g. cn=rallen,ou=Sales,dc=rallencorp,dc=com
# ------ END CONFIGURATION ---------
use Win32::OLE;
$Win32::OLE::Warn = 3;
my $objUser = Win32::OLE->GetObject("LDAP://" . $strUserDN);
my $objLogon = $objUser->Get("lastLogonTimestamp");
my $intLogonTime = ($objLogon->HighPart * 232) + $objLogon->LowPart;
$intLogonTime = $intLogonTime / (60 * 10000000);
$intLogonTime = $intLogonTime / 1440;
print "Approx last logon timestamp: ", scalar localtime($intLogonTime),"\n";
(Msg. 2) Posted: Mon Jun 23, 2008 7:41 am
Post subject: Re: last login time for a user [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
<none.DeleteThis@none.com> wrote in message
news:485f16b7$0$27944$4c368faf@roadrunner.com...
> Hello,
>
> I'm required to show last login times for a user when they login to a
> server running Windows Server 2003. I'm trying to use the script at the
> end of this message to query the DIT and retrieve the value of
> lastLogonTimestamp for the user currently logging in. The script I'm using
> is a common script that is found on many websites and the VBscript version
> comes from the WIndows Server Cookbook. The problem I'm having is that the
> script always returns Dec 31 1969 despite the fact that the domain
> administrator account I'm querying just logged in because I'm running the
> script as the domain administrator account for test purposes.
>
> One version of the script uses subtraction on the "- $objLogon->LowPart"
> but I tried that and it doesn't change the printed value.
>
> Modifying the last 2 $intLogonTime lines at the end of the script don't
> even change the printed value either. I'm not sure why this is happening.
> Can anyone help? The value is being set. I verified using ADSI Edit.
>
>
> # ------ SCRIPT CONFIGURATION ------
> my $strUserDN = "<UserDN>"; # e.g.
> cn=rallen,ou=Sales,dc=rallencorp,dc=com
> # ------ END CONFIGURATION ---------
> use Win32::OLE;
> $Win32::OLE::Warn = 3;
> my $objUser = Win32::OLE->GetObject("LDAP://" . $strUserDN);
> my $objLogon = $objUser->Get("lastLogonTimestamp");
> my $intLogonTime = ($objLogon->HighPart * 232) + $objLogon->LowPart;
> $intLogonTime = $intLogonTime / (60 * 10000000);
> $intLogonTime = $intLogonTime / 1440;
> print "Approx last logon timestamp: ", scalar
> localtime($intLogonTime),"\n";
The "232" in the script above should be "2^32" (2 to the 32nd power). The
final answer should be in UTC (Coordinated Universal Time, or what was once
called GMT).
(Msg. 3) Posted: Wed Jun 25, 2008 7:56 am
Post subject: Re: last login time for a user [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
Check out a vbscript I have maybe there is some code in there to help you
out.
Please no e-mails, any questions should be posted in the NewsGroup
This posting is provided "AS IS" with no warranties, and confers no rights.
<none.DeleteThis@none.com> wrote in message
news:485f16b7$0$27944$4c368faf@roadrunner.com...
> Hello,
>
> I'm required to show last login times for a user when they login to a
> server running Windows Server 2003. I'm trying to use the script at the
> end of this message to query the DIT and retrieve the value of
> lastLogonTimestamp for the user currently logging in. The script I'm using
> is a common script that is found on many websites and the VBscript version
> comes from the WIndows Server Cookbook. The problem I'm having is that the
> script always returns Dec 31 1969 despite the fact that the domain
> administrator account I'm querying just logged in because I'm running the
> script as the domain administrator account for test purposes.
>
> One version of the script uses subtraction on the "- $objLogon->LowPart"
> but I tried that and it doesn't change the printed value.
>
> Modifying the last 2 $intLogonTime lines at the end of the script don't
> even change the printed value either. I'm not sure why this is happening.
> Can anyone help? The value is being set. I verified using ADSI Edit.
>
>
> # ------ SCRIPT CONFIGURATION ------
> my $strUserDN = "<UserDN>"; # e.g.
> cn=rallen,ou=Sales,dc=rallencorp,dc=com
> # ------ END CONFIGURATION ---------
> use Win32::OLE;
> $Win32::OLE::Warn = 3;
> my $objUser = Win32::OLE->GetObject("LDAP://" . $strUserDN);
> my $objLogon = $objUser->Get("lastLogonTimestamp");
> my $intLogonTime = ($objLogon->HighPart * 232) + $objLogon->LowPart;
> $intLogonTime = $intLogonTime / (60 * 10000000);
> $intLogonTime = $intLogonTime / 1440;
> print "Approx last logon timestamp: ", scalar
> localtime($intLogonTime),"\n";
(Msg. 4) Posted: Fri Jun 27, 2008 8:05 pm
Post subject: Re: last login time for a user [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
Richard Mueller [MVP] wrote:
> <none.RemoveThis@none.com> wrote in message
> news:485f16b7$0$27944$4c368faf@roadrunner.com...
>> Hello,
>>
>> I'm required to show last login times for a user when they login to a
>> server running Windows Server 2003. I'm trying to use the script at the
>> end of this message to query the DIT and retrieve the value of
>> lastLogonTimestamp for the user currently logging in. The script I'm using
>> is a common script that is found on many websites and the VBscript version
>> comes from the WIndows Server Cookbook. The problem I'm having is that the
>> script always returns Dec 31 1969 despite the fact that the domain
>> administrator account I'm querying just logged in because I'm running the
>> script as the domain administrator account for test purposes.
>>
>> One version of the script uses subtraction on the "- $objLogon->LowPart"
>> but I tried that and it doesn't change the printed value.
>>
>> Modifying the last 2 $intLogonTime lines at the end of the script don't
>> even change the printed value either. I'm not sure why this is happening.
>> Can anyone help? The value is being set. I verified using ADSI Edit.
>>
>>
>> # ------ SCRIPT CONFIGURATION ------
>> my $strUserDN = "<UserDN>"; # e.g.
>> cn=rallen,ou=Sales,dc=rallencorp,dc=com
>> # ------ END CONFIGURATION ---------
>> use Win32::OLE;
>> $Win32::OLE::Warn = 3;
>> my $objUser = Win32::OLE->GetObject("LDAP://" . $strUserDN);
>> my $objLogon = $objUser->Get("lastLogonTimestamp");
>> my $intLogonTime = ($objLogon->HighPart * 232) + $objLogon->LowPart;
>> $intLogonTime = $intLogonTime / (60 * 10000000);
>> $intLogonTime = $intLogonTime / 1440;
>> print "Approx last logon timestamp: ", scalar
>> localtime($intLogonTime),"\n";
>
> The "232" in the script above should be "2^32" (2 to the 32nd power). The
> final answer should be in UTC (Coordinated Universal Time, or what was once
> called GMT).
>
I forgot to verify the script pasted into the email okay. I already have
2^32 in the script. It just didn't paste in correctly to Thunderbird for
some reason.
(Msg. 5) Posted: Tue Jul 29, 2008 3:26 pm
Post subject: Re: last login time for a user [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
There is a program for that is called "Last Logon". you can use it.
<none.DeleteThis@none.com> wrote in message
news:485f16b7$0$27944$4c368faf@roadrunner.com...
> Hello,
>
> I'm required to show last login times for a user when they login to a
> server running Windows Server 2003. I'm trying to use the script at the
> end of this message to query the DIT and retrieve the value of
> lastLogonTimestamp for the user currently logging in. The script I'm using
> is a common script that is found on many websites and the VBscript version
> comes from the WIndows Server Cookbook. The problem I'm having is that the
> script always returns Dec 31 1969 despite the fact that the domain
> administrator account I'm querying just logged in because I'm running the
> script as the domain administrator account for test purposes.
>
> One version of the script uses subtraction on the "- $objLogon->LowPart"
> but I tried that and it doesn't change the printed value.
>
> Modifying the last 2 $intLogonTime lines at the end of the script don't
> even change the printed value either. I'm not sure why this is happening.
> Can anyone help? The value is being set. I verified using ADSI Edit.
>
>
> # ------ SCRIPT CONFIGURATION ------
> my $strUserDN = "<UserDN>"; # e.g.
> cn=rallen,ou=Sales,dc=rallencorp,dc=com
> # ------ END CONFIGURATION ---------
> use Win32::OLE;
> $Win32::OLE::Warn = 3;
> my $objUser = Win32::OLE->GetObject("LDAP://" . $strUserDN);
> my $objLogon = $objUser->Get("lastLogonTimestamp");
> my $intLogonTime = ($objLogon->HighPart * 232) + $objLogon->LowPart;
> $intLogonTime = $intLogonTime / (60 * 10000000);
> $intLogonTime = $intLogonTime / 1440;
> print "Approx last logon timestamp: ", scalar
> localtime($intLogonTime),"\n";
(Msg. 6) Posted: Sun Aug 03, 2008 1:53 pm
Post subject: Re: last login time for a user [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
see if you can use the OLDCMP tool from joeware.net
BLOG (WEB-BASED)--> http://blogs.dirteam.com/blogs/jorge/default.aspx
BLOG (RSS-FEEDS)--> http://blogs.dirteam.com/blogs/jorge/rss.aspx
------------------------------------------------------------------------------------------
* How to ask a question --> http://support.microsoft.com/?id=555375
------------------------------------------------------------------------------------------
* This posting is provided "AS IS" with no warranties and confers no rights!
* Always test ANY suggestion in a test environment before implementing!
------------------------------------------------------------------------------------------
#################################################
#################################################
------------------------------------------------------------------------------------------
"Mumin CICEK" <mumin.cicek RemoveThis @akademinet.net> wrote in message
news:O6Gt9XX8IHA.4988@TK2MSFTNGP04.phx.gbl...
> There is a program for that is called "Last Logon". you can use it.
>
>
> <none RemoveThis @none.com> wrote in message
> news:485f16b7$0$27944$4c368faf@roadrunner.com...
>> Hello,
>>
>> I'm required to show last login times for a user when they login to a
>> server running Windows Server 2003. I'm trying to use the script at the
>> end of this message to query the DIT and retrieve the value of
>> lastLogonTimestamp for the user currently logging in. The script I'm
>> using is a common script that is found on many websites and the VBscript
>> version comes from the WIndows Server Cookbook. The problem I'm having is
>> that the script always returns Dec 31 1969 despite the fact that the
>> domain administrator account I'm querying just logged in because I'm
>> running the script as the domain administrator account for test purposes.
>>
>> One version of the script uses subtraction on the "- $objLogon->LowPart"
>> but I tried that and it doesn't change the printed value.
>>
>> Modifying the last 2 $intLogonTime lines at the end of the script don't
>> even change the printed value either. I'm not sure why this is happening.
>> Can anyone help? The value is being set. I verified using ADSI Edit.
>>
>>
>> # ------ SCRIPT CONFIGURATION ------
>> my $strUserDN = "<UserDN>"; # e.g.
>> cn=rallen,ou=Sales,dc=rallencorp,dc=com
>> # ------ END CONFIGURATION ---------
>> use Win32::OLE;
>> $Win32::OLE::Warn = 3;
>> my $objUser = Win32::OLE->GetObject("LDAP://" . $strUserDN);
>> my $objLogon = $objUser->Get("lastLogonTimestamp");
>> my $intLogonTime = ($objLogon->HighPart * 232) + $objLogon->LowPart;
>> $intLogonTime = $intLogonTime / (60 * 10000000);
>> $intLogonTime = $intLogonTime / 1440;
>> print "Approx last logon timestamp: ", scalar
>> localtime($intLogonTime),"\n";
>
>
All times are: Eastern Time (US & Canada) (change)
Page 1 of 1
You can post new topics in this forum You can reply to topics in this forum You can edit your posts in this forum You can delete your posts in this forum You can vote in polls in this forum