WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

wNT
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

How to Get Last logon date

Keywords: 	   wntUserGetDat

Question:

Hi all - I'm trying to determine the last logon date / time for each user on an NT4 network. I've looked at the various Winbatch (97D) functions like wNTUserxxx but can't spot a way of doing it. (I know I have to interrogate each BDC because the PDC database isn't up to date at any given time).

Can you help please?

Answer:

Ummm

wntUserGetDat from the "The list of fixes and improvements file":

    
Added new "elements" to wntUserGetDat:

        "last_logon"  (s):  last logon time, in "YYYY:MM:DD:hh:mm:ss" format
        "last_logoff" (s):  last logoff time, in "YYYY:MM:DD:hh:mm:ss" format

          These times are maintained separately on each Backup Domain Controller
          (BDC) in the domain.  To get an accurate value, each BDC in the
          domain must be queried, and the largest value is used.

          The return value will always contain a 4-digit year.  If no value is
          available, "0000:00:00:00:00:00" is returned.

        Note: These elements cannot be set using wntUserAddDat or wntUserSetDat.
In the 98-99 version of WinBatch:
	wntUserGetDat(server, user, "last_logon")
Returns time in "YYYY:MM:DD:hh:mm:ss" format. Needs WinBatch 98D or higher. See FIXES text file for more info. These times are maintained separately on each Backup Domain Controller (BDC) in the domain. To get an accurate value, each BDC in the domain must be queried, and the largest value is used.

The return value will always contain a 4-digit year. If no value is available, "0000:00:00:00:00:00" is returned.

Note: These elements cannot be set using wntUserAddDat or wntUserSetDat.


Article ID:   W14272
Filename:   wxxUserGetDat and Last Logon Date.txt
File Created: 1999:10:26:11:22:56
Last Updated: 1999:10:26:11:22:56