Your basic ITPro blog... What's going on at work, what I'm interested in.

Thursday, June 12, 2008

Logging Logon Events from Within the Logon Script

We have been having issues (sporadic, but annoying) with people not getting drive mappings. Drives are being mapped by our logon script, assigned via GPO.

We have identified that, in some instances, drives are not mapped because people are not actually logging in. This is especially true for our laptop users. I myself am a culprit, as I usually go in to 'Stand By', rather than shutting down.

But, the annoying part comes when people do log in but still don't get their drives.

To help troubleshoot this, I have added some logging code to the logon script. So now each time the logon script runs (presumably triggered by a user logon event), the logon script does the following:

  • maps appropriate drives for the user (example: U:\, S:\, G:\, R:\)
  • logs these events to a .txt file
    • checks to see if a txt file named <username>.txt exists
      • if not, it creates the file
    • Appends and entry
      • date and timestamp the entry
      • logs OK, FAIL, SKIP for each drive mapping

What I end up with is a text file for each user account with entries that look like:
(I removed username and computername)

START RUN: 6/12/2008  9:29:11 AM
<username> on computer <computername>
   U: map OK
   G: map OK
   S: map OK
   R: map SKIP
END RUN:   6/12/2008  9:29:13 AM
--------------------------------

My hope is that this will do a few things. First, it will give me a record of each login script run for each user. Second, it will report either OK, SKIP, for FAIL for each drive map attempt. This should give me better information to work with as we troubleshoot logon script/drive mapping issues.

No comments:

Additional Info

My photo
email: support (AT) mangrumtech (DOT) com
mobile: 480-270-4332