No announcement yet.

Log on/off script not working

  • Filter
  • Time
  • Show
Clear All
new posts

  • Log on/off script not working


    I have placed this here as I have been told the script's do work, so have to assume I have missed something on the GPO side

    We need a csv to show what time a user log's on/off, and where.

    Two vb scripts have been created and placed within the sysvol\scripts folder.

    I have created a "test OU" and placed "testuser" inside it.

    I have edit the "testscript GPO" (which is linked enabled) to the "test OU" so that the User settings > Windows Settings > Log on /Log off scripts are used although they dont write to the relevant .csv.

    At first, the user was still picking up the original script (applied at the domain level) and about to be replaced by this one, so i blocked the inheritance. Still not working.

    I have logged on as testuser and run gpresult which states the user is picking up the relevant gpo.

    Can anyone suggest what I have left out/done wrong?

    Thanks for looking.

  • #2
    Re: Log on/off script not working

    Is the path used to the *.csv file a mapped drive? then try using the UNC path instead.
    The USERINIT process will impersonate the user logging on. Does the share permissions, folder and file permissions allows editing to the csv file? (allow "All users").

    Are the logon and the logoff scripts both correctly written to the users part of the registry?:
    - HKEY_CURRENT_USER\Software\Policies\Microsoft\Wind ows\System\ Scripts\Logon
    - HKEY_CURRENT_USER\Software\Policies\Microsoft\Wind ows\System\ Scripts\Logoff
    The policy write it there and the USERINIT process will read it there and launch the script.

    The Resultant Set of Policy information can tell you if the script ran by reporting the time the script ran. If the script has never executed successfully, you will see either a time of “0” or a blank entry in the Last Executed column. Note, a gpupdate /force will reset that value.
    For possible errors running the script look in application_events for records with as the sourse: USERINIT

    If the entries exist in the registry, no events recorded, but the information shows time of “0” or a blank, you might have to Disable the 'Fast Logon Optimization feature' for the computer.
    [Configuration\Administrative Templates\System\Logon\ Always wait for the network at computer startup and logon].

    When the logonscript happen to launch a process that'll run in its own time independed from the time the logon script process is running, then you should disable 'Run logon scripts synchronously' [\Administrative Templates\System\Logon]. Or (better) keep the scripts running synchronously and use the logon script to create a runonce entry for lauching the other process. (


    This posting is provided "AS IS" with no warranties, and confers no rights.


    ** Remember to give credit where credit's due **
    and leave Reputation Points for meaningful posts


    • #3
      Re: Log on/off script not working

      Hi Rems,

      Thank you for all your valuble input - appreciated.

      The csv has been placed within the sysvol folder and does have the correct permissions using the unc. The scripts are writing to the correct part of the registry and showing within RSOP.

      That is as far as my troubleshooting went; I received a new script which ran within an exisiting script (although after code wise if you see what I mean! ) linked to the domain policy -this is now working.

      I would be interested to know where the GPO/script did go wrong although now it is working is no longer a requirement. You did also raise an intersting solution of disabling the "fast logon optimization feature" - sometimes the odd workstation will receive an error stating the mapped drives are not availible immedialtely after loading the desktop.

      Thanks for your help.