Kaseya Community

Script to compare time to an NTP server

  • Has anyone had an issue with the DST change? We have. How could I get all workstations and server to compare time to a server with the correct time to see if the DST patch worked?

    Also, would it be easier to check the nodes' registry settings for DST:

    [HKEY_LOCAL_MACHINE\Software\Microsoft\Clock]HomeDST": REG_DWORD

    for value "1", and if "0", have it changed?


    Legacy Forum Name: Script to compare time to an NTP server,
    Legacy Posted By Username: matt.jaramillo
  • I would like to know how to do this, too. Also I'd like a way to quickly tell which time zone each computer is set for...



    --arthur


    Legacy Forum Name: System Administration Scripts,
    Legacy Posted By Username: arthur
  • We also have noticed a number of machines that have received the patch but still have not changed to daylight savings time. Still troubleshooting to identify why..

    We also recently found the 'Time Zone' filter column under Agent,Agent Status, Select Columns which will show you which time zone each machine is in and then see which machines are incorrect.


    Legacy Forum Name: System Administration Scripts,
    Legacy Posted By Username: cberger
  • I found what you are talking about, however, I noticed the time was incorrect in Kaseya. I confirmed that the time and TZ on the workstations are correct, then went to kaseya and found the zones were reporting incorrectly. Strange?


    Legacy Forum Name: System Administration Scripts,
    Legacy Posted By Username: matt.jaramillo
  • I have the same inconsistency... i am in time zone GMT-5, but all the correctly configured machines will show GMT-4 in Kaseya despite having GMT-5 on the desktop.but I was able to identify any incorrectly configured machines by just lookng for any ones in the GMT-5 timezone.. and had more incorrect machines than i expected. Most of them were fixed byforcing an install of the patch and rebooting.

    Legacy Forum Name: System Administration Scripts,
    Legacy Posted By Username: cberger
  • For Windows XP at least this shouldn't be too hard to ascertain. I haven't actually worked out all the details of a script yet, but you should be able grab the output of issuing the following command:

    w32tm /tz

    Then parse this output to determine if it is actually showing the correct timezone information or not... For example here is the output from a machine of mine where the patch was applied correctly and it is working properly..

    Time zone: Current:TIME_ZONE_ID_DAYLIGHT Bias: 360min (UTC=LocalTime+Bias)
    [Standard Name:"Central Standard Time" Bias:0min DateSadM:11 D:1 DoW:0)]
    [Daylight Name:"Central Daylight Time" Bias:-60min DateSadM:3 D:2 DoW:0)]

    On one where it did NOT work correctly the output looks more like this...

    Time zone: Current:TIME_ZONE_ID_STANDARD Bias: 360min (UTC=LocalTime+Bias)
    [Standard Name:"Central Standard Time" Bias:0min DateSadM:10 D:5 DoW:0)]
    [Daylight Name:"Central Daylight Time" Bias:-60min DateSadM:4 D:1 DoW:0)]

    You'll note there are three main differences between the ones that worked and the ones that don't.

    #1. on the first line TIME_ZONE_ID_STANDARD vs TIME_ZONE_ID_DAYLIGHT. The machine where the patch worked is specifically showing up as already in Daylight savings time.

    #2 The Date for standard time. The one that works shows the later start date for "standard" time as the first sunday in November. Vs.. The old one showing in October.

    #3 The date for Daylight time. Showing in March, rather than April.

    I know this command is available and works on XP and 2003, I don't have any 2000 machines handy to test against.


    Legacy Forum Name: System Administration Scripts,
    Legacy Posted By Username: Jonathan
  • Thank you, I think this is going to work pretty well. I created a script in Kaseya that:

    * Runs the command
    * Creates an output text file
    * Reads the output file and searches for DAYLIGHT
    * Emails an alert containing workstations that are not updated
    * Runs another script to force the patch install
    * Emails the task was completed and runs the command again to verify that it is now patched

    Now how about Echange?? Smile



    Legacy Forum Name: System Administration Scripts,
    Legacy Posted By Username: matt.jaramillo
  • My best suggestion there would be devise some way of looking at the file version or file date on store.exe...

    For example for the DST patch applied to an Exchange 2003 box, the store.exe version should be 6.5.7651.61 with a date of Dec 13, 2006 23:37 and a size of 4,879,360.




    Legacy Forum Name: System Administration Scripts,
    Legacy Posted By Username: Jonathan
  • Exchange.zip
    I have wonderful news!!!!

    Johnathan, you rock!! Talk about finding open windows to crawl through. I have attached a file I think that might help out with this issue. Instructions included.

    Matt


    Legacy Forum Name: System Administration Scripts,
    Legacy Posted By Username: matt.jaramillo