logging users info: Time Zoning it.

Posted on 2006-04-21
Medium Priority
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
  • 3

Expert Comment

ID: 16536782
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?  

Expert Comment

ID: 16536806
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 11

Author Comment

ID: 16538977
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

Accepted Solution

la_pepe59 earned 1500 total points
ID: 16546475
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!

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Tech giants such as Amazon and Google have sold Alexa and Echo to such an extent that they have become household names. And soon they are expected to be used by commoners in their homes, ordering takeout, picking out a song, answering trivia questio…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Loops Section Overview
Suggested Courses

850 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