![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | winnt provider and lastlogin using vbscript I have a Windows 2003 workgroup server. No AD, domain, etc. In my login script, using vbscript, I need to be able to tell the user when they last logged on. I thought I had this licked by using the winnt provider and the lastlogin attribute. However, during the login process, it appears as if lastlogin has already been updated to the current time, completely having overwritten what I was trying to capture. During the user login process, is there any other attribute that I can grab that will tell me when the user last logged in? Thanks. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: winnt provider and lastlogin using vbscript <awrightus@xxxxxx> wrote in message news:1458b1bf-feb4-4074-a313-9ab47eb14458@xxxxxx Quote: >I have a Windows 2003 workgroup server. No AD, domain, etc. In my > login script, using vbscript, I need to be able to tell the user when > they last logged on. I thought I had this licked by using the winnt > provider and the lastlogin attribute. However, during the login > process, it appears as if lastlogin has already been updated to the > current time, completely having overwritten what I was trying to > capture. During the user login process, is there any other attribute > that I can grab that will tell me when the user last logged in? > Thanks. use. The only thing I can think if is to save the date/time for future use. Since this is a local account, you could save the information in a text somewhere on the computer everyone has access to, perhaps in a file named after the username. -- Richard Mueller MVP Directory Services Hilltop Lab - http://www.rlmueller.net -- |
My System Specs![]() |
| | #3 (permalink) |
| | Re: winnt provider and lastlogin using vbscript "Richard Mueller [MVP]" <rlmueller-nospam@xxxxxx> wrote in message news:%2321OkDm8IHA.4924@xxxxxx Quote: > > <awrightus@xxxxxx> wrote in message > news:1458b1bf-feb4-4074-a313-9ab47eb14458@xxxxxx Quote: >>I have a Windows 2003 workgroup server. No AD, domain, etc. In my >> login script, using vbscript, I need to be able to tell the user when >> they last logged on. I thought I had this licked by using the winnt >> provider and the lastlogin attribute. However, during the login >> process, it appears as if lastlogin has already been updated to the >> current time, completely having overwritten what I was trying to >> capture. During the user login process, is there any other attribute >> that I can grab that will tell me when the user last logged in? >> Thanks. > I noticed the same thing some time ago. There is no other attribute you > can use. The only thing I can think if is to save the date/time for future > use. Since this is a local account, you could save the information in a > text somewhere on the computer everyone has access to, perhaps in a file > named after the username. > > -- > Richard Mueller > MVP Directory Services > Hilltop Lab - http://www.rlmueller.net > -- > saving the logon date/time yourself somewhere the user has permissions: ========= Option Explicit Dim objNetwork, strName, strFile, objFSO, objFile Dim strLast Const ForReading = 1 ' Retrieve user name. Set objNetwork = CreateObject("Wscript.Network") strName = objNetwork.UserName ' Specify local log file for this user. strFile = "c:\scripts\" & strName & ".log" Set objFSO = CreateObject("Scripting.FileSystemObject") ' Read the file if it exists. ' Trap the error if it does not exist. On Error Resume Next Set objFile = objFSO.OpenTextFile(strFile, ForReading) If (Err.Number = 0) Then On Error GoTo 0 ' Read the last logon date/time and display. strLast = objFile.ReadLine objFile.Close Call MsgBox("You last logged on at " & strLast) End If On Error GoTo 0 ' Save the new last logon date/time in the log file. Set objFile = objFSO.CreateTextFile(strFile, True) objFile.WriteLine CStr(Now()) objFile.Close -- Richard Mueller MVP Directory Services Hilltop Lab - http://www.rlmueller.net -- |
My System Specs![]() |
| | #4 (permalink) |
| | Re: winnt provider and lastlogin using vbscript "Richard Mueller [MVP]" <rlmueller-nospam@xxxxxx> wrote in message news:%2321OkDm8IHA.4924@xxxxxx Quote: > > <awrightus@xxxxxx> wrote in message > news:1458b1bf-feb4-4074-a313-9ab47eb14458@xxxxxx Quote: >>I have a Windows 2003 workgroup server. No AD, domain, etc. In my >> login script, using vbscript, I need to be able to tell the user when >> they last logged on. I thought I had this licked by using the winnt >> provider and the lastlogin attribute. However, during the login >> process, it appears as if lastlogin has already been updated to the >> current time, completely having overwritten what I was trying to >> capture. During the user login process, is there any other attribute >> that I can grab that will tell me when the user last logged in? >> Thanks. > I noticed the same thing some time ago. There is no other attribute you > can use. logged on now, then when you started this session, that was very likely your last (more recent) logon. If lastlogon is not updated at the end of each logon event, when should it be updated? /Al |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| WinNT provider and CTP3 | PowerShell | |||
| Add built-in account to local group using WinNT: ADSI provider | PowerShell | |||
| how do i list winNT provider properties ? | PowerShell | |||
| [VBScript](Set objUser = GetObject("WinNT://" & strComputer)) -eq [Powershell]? | PowerShell | |||
| WINNT.SIF | Vista installation & setup | |||