Answered Find User Logon Duration

  • Thursday, September 20, 2012 4:00 PM
     
     

    I have a TEST server on our network and need to determine is users are spending any time on that server TESTING and how long they spend on that server.

    I quick search of the internet resulted in 'Find User Logon Duration' VBScript, at http://gallery.technet.microsoft.com/scriptcenter/Find-user-logon-duration-d8b8c8e1, but its not returning any information.

    Has anyone had any luck with this script?  And, was there anything special that needed to be done to get it to work?


    "Fate rarely calls upon us at a moment of our choosing…"

All Replies

  • Thursday, September 20, 2012 4:15 PM
     
     
    You need to download the script from the download link at the top of the page.  The script sample posted on the description page is not complete (by far).

    Grant Ward, a.k.a. Bigteddy

  • Thursday, September 20, 2012 5:24 PM
     
     

    Did that. Downloaded the ZIP file and didn't anything that the script was trying to call.  The 'Documentation.htm' is basically the same as the web page.  Added section code in Example 01 to collect user logon duration information from a computer.  And it returns the following.

     

    H:\>notepad FindUserLogonDuration.vbs

    H:\FindUserLogonDuration>cscript FindUserLogonDuration.vbs
    Microsoft (R) Windows Script Host Version 5.6

     

    "ComputerName","TargetDomainName","TargetUserName","LogonType","LogonDate","LogoffDate","LogonDuration(Minutes)"
    strLocalComputerName= TS-CTXXAFIA12

    H:\>

     

    I added the Echo of the ComputerName, just to see if it was reaching that point in the script.

     


    "Fate rarely calls upon us at a moment of our choosing…"

  • Thursday, September 20, 2012 5:29 PM
     
     
    I think the author forgot to mention that you must take the echo's off for it to work.

    Grant Ward, a.k.a. Bigteddy

  • Thursday, September 20, 2012 5:42 PM
     
     
    Nope.  That didn't help.

    "Fate rarely calls upon us at a moment of our choosing…"

  • Thursday, September 20, 2012 6:48 PM
     
     
    I get the same result: nothing.  I've set the computer name and the dates sensibly, and it seems to be processing, but there is no result.  Perhaps that's why this script is not very popular.

    Grant Ward, a.k.a. Bigteddy

  • Thursday, September 20, 2012 7:24 PM
     
     Answered

    It only monitors these codes: (EventCode='4624' OR EventCode='4647')

    I believe they have to be enabled via policy fo logon events auditing.


    ¯\_(ツ)_/¯

  • Friday, September 21, 2012 7:38 AM
     
      Has Code

    Just like an uptime report, a report based on these entries would be difficult to implement.  Ideally you want one logon event for every logoff event (or vice versa).  After running some tests, I can see that this isn't the case in reality.  See transcript:

    PS C:\scripts> Get-EventLog -LogName security | ? { $_.eventid -eq 4624 } | Measure-Object
    
    
    Count    : 2192
    
    
    PS C:\scripts> Get-EventLog -LogName security | ? { $_.eventid -eq 4647 } | Measure-Object
    
    
    Count    : 44
    


    Grant Ward, a.k.a. Bigteddy

  • Friday, September 21, 2012 12:55 PM
     
     
    Thank you, jrv.

    "Fate rarely calls upon us at a moment of our choosing…"

  • Friday, September 21, 2012 12:55 PM
     
     
    Thanks

    "Fate rarely calls upon us at a moment of our choosing…"