Re: Users last logon info from logon script

From: Torgeir Bakken \(MVP\) (Torgeir.Bakken-spam_at_hydro.com)
Date: 04/23/05


Date: Sat, 23 Apr 2005 18:51:40 +0200

monk wrote:

> Hi Torgeir,
>
> I put this line in the users logon script: wscript
> \\dc1\netlogon\lastlogon.vbs. Then when users logon, they get a
> popup window tells them the last logn time - it all seemed good.
> But, the last logon time that is in the popup window is actually
> the cyrrently logon time!?
>
> If I run the script manually, it shows the last logon time. Even
> when I run the logon script manuelly, it still shows the last
> logon time. But when users logon, the popup window shows the
> currect logon time.
>
> I guess it is because Windows update the lastlogon attribute
> once a user logs on to the domain? How can I prevent this?

You can't.

> How can I get the correct LAST logon time?

You need to save the value obtained by the script somewhere, and
display the saved value at next logon. You can save the value in a
file on a file server, or in an unused attribute in the user object
in AD.

-- 
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx


Relevant Pages

  • Re: Users last logon info from logon script
    ... I put this line in the users logon script: ... If I run the script manually, it shows the last logon time. ... I guess it is because Windows update the lastlogon attribute once a user ... Then, for each Domain Controller, ADO is used to search the ...
    (microsoft.public.security)
  • Re: slow logon
    ... in the logon time have been reduced so far. ... update the time for the clients that talk to the dc as the logon server. ... start up script in AD to apply updates to the clients machines which is ...
    (microsoft.public.windows.server.active_directory)
  • Logon Script Causing Laptops To Hang - Problems in script?
    ... I'm using the following script to map drives, ... functions when users logon to our domain. ... 'Disconnects Drives This assures everyone has the same drive mappings. ... objNetwork.MapNetworkDrive strTrainDrv, strPath ...
    (microsoft.public.scripting.vbscript)
  • Re: Disable multiple computers logon
    ... script appended username, computername, date/time, and IP address to a text ... I always cautioned that since the logon scripts ... a malicious user could modify the logs. ...
    (microsoft.public.windows.server.scripting)
  • Re: add computer account to AD security group during logon
    ... groups are filled after the logon. ... logoff script that log information to a text file. ... Dim objUserGroup, objComputerGroup ...
    (microsoft.public.windows.server.active_directory)