We help IT Professionals succeed at work.

logging users info: Time Zoning it.

phileoca
phileoca asked
on
Medium Priority
164 Views
Last Modified: 2010-04-13
greetings,

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
:Logging
If Exist "\\ServerName\SYSVOL\Logs\LogOns.Log" GoTo START
Echo Log File > "\\ServerName\SYSVOL\Logs\LogOns.Log"
:START
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"
Comment
Watch Question

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?  
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?

Author

Commented:
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
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!

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.