logging users info: Time Zoning it.

Posted on 2006-04-21
Last Modified: 2010-04-13

I currently have in place a policy script that is logging user info upon log on and log off.
Is there a way to either:
a) append the time zone to the log file
b) log the time in GMT.

my current script looks like this:

@echo off
rem me 04/11/2006
If Exist "\\ServerName\SYSVOL\Logs\LogOns.Log" GoTo START
Echo Log File > "\\ServerName\SYSVOL\Logs\LogOns.Log"
Echo Log On,%USERNAME%,%COMPUTERNAME%,%Date:~0,12%,%Time:~0,5%>> "\\ServerName\SYSVOL\Logs\LogOns.Log"
rem Netstat  -an  |find  "3389"  |find  /I  "established"  >> "\\ServerName\SYSVOL\Logs\LogOns.Log"
Question by:phileoca
    LVL 3

    Expert Comment

    You could put a command in the batch file to query a registry key value such as..

    reg query hklm\system\currentcontrolset\control\timezoneinformation /v standardname

    then appened it to the log.  How many different time zones do you have that would be logged and is it in a domain?  
    LVL 3

    Expert Comment

    Nevermind about the above command line...that is for xp not 2000.  

    How many different time zones do you have that would be logged and are you in a domain?
    LVL 14

    Author Comment

    1) yes it's a domain
    2) all workstations are XP, but the domain policy in on a win2k server
    3) time zones... 10+  that's why a GMT would be ideal
    LVL 3

    Accepted Solution

    I am not aware of a way to give you GMT for all the time zones.  Here are a few options, I'm not sure if any are a great solution but you can decide or may give you a different idea...

    1. If the workstations are xp you should be able to use the 1st command line above to get the time zone that it is in, it isn't pretty though.
    2.  You could try the 'net time' command and point it to a particular server in a particular time zone...ex. net time \\server
      I don't know how much traffic that will generate to the particular server providing the time but it will give you 2 seperate times if it is in a different zone than the local machine.
    3.  You could set an environment variable on the machines with the 'setx' from the resource kit.  Then pull the variable in the script...example...
    setx timezone -k hkey_local_machine\system\currentcontrolset\control\timezoneinformation\standardname -m

    then you would be able to echo %timezone% in the script but that would set an environment variable to for the each machine.  I haven't tested to see if it will run under regular user rights but does work with admin rights.

    You may be able to do something with vb scripting but I don't know much about that...maybe some else will give some possible solutions.

    Good luck!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
    For Sennheiser, comfort, quality and security are high priority areas. This paper addresses the security of Bluetooth technology and the supplementary security that Sennheiser’s Contact Center and Office (CC&O) headsets provide.  
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now