Kaseya Community

How to synchronize endpoint time with kserver time

This question has suggested answer(s)


I am working in a unique environment where my endpoints do not have outside internet access, nor do they have access to a Net Time Protocol server. I am trying to work out a method to synchronize my endpoints with the time that is coming from the kserver. I am hoping to get the time value from the kserver, and then use the local machine's time zone to offset that value to the correct time and then set that time in Windows 7 on the endpoint. 

Does anyone know a method I can use to achieve this? I've got scripts to manually change the time on endpoints, I'm just not sure how to query the kserver's time - if I could do that then I could save that to a variable and then pass it to the endpoint in a shell command to set the time.

Thanks for your help!

[edited by: Lene1031 at 11:10 AM (GMT -7) on Apr 30, 2018]
All Replies
  • I would suggest that using the kserver time is not the best solution since it's time may differ from other systems in the environment which could create a problem unto itself.  

    I would look at using meinberg NTP to create an internal time server on any server internal to the network that all end-points can access or to look at the tome server settings on the firewall (or other networking devices) as an alternative time server for the  network.

  • I second that - Mienberg NTP is a great solution for Windows - regular NTP is available for other platforms natively. Time is not something to trivialize. Use a GPS receiver for time source (best) or radio clock if you can. Mienberg NTP is free.

    If the environment doesn't have access to Internet, GPS, or Radio clocks, then configure NTP on two servers in the environment as peers syncing rom their local / internal clock. Set time on just those two systems via VSA procedure ONCE daily. All other systems should get time from those NTP peers.

  • Another options that I've done in secure environments in the past may or may not be available to you depending on what you are using for routers on the network.

    I had setup to specifically allow the edge Cisco router for the secure network access *only* to NTP, and set the Cisco router up so that it would function as an NTP source for the rest of the network.

    The most complex setup I ever had to deal with even the edge router on the secure network wasn't  allowed to have "internet" access of any kind, so I had daisy chained NTP servers... The main Cisco router/firewall had NTP enabled on it, and my routers behind it got their time from that router, and could in turn serve as the NTP server to devices behind them.  

    Overall as the others here mention I would avoid trying to do something direct from the Kaseya server and find an alternate source for accurate time in one manner or another.

  • I appreciate all these replies, however the environment I am in does not allow me to use any of these methods. Each one of my endpoints is a standalone device at a bank with an incredibly locked down network. I don't even have access to the routers as they are managed by the bank, and each site I only have one device, so there is no way to set up a local NTP server.

    The ONLY solution to my unique set up is getting the kserver time and using that to manipulate the time on the endpoints. If anyone can suggest ways to get the time from the kserver, that's all I would need to run with my time synch issue. Thanks!

  • Can anyone else help with this? I do not need recommendations on NTP servers... I simply need to find out how I can query the time from the kserver. If anyone can assist me I would really appreciate it. Thank you.

  • Messy business and no guarantee of high accuracy, but assuming you are using on-prem VSA:

    1. Create on your VSA server "X:\Kaseya\xml\Procedures\AgentProcSQL\0\SQLRead\GetKserverTime.xml" (where X is your install drive for Kaseya} containing the following:

    <?xml version="1.0" encoding="utf-8" ?>


     <queryDef label="Get Kaseya Server time" sql="SELECT GETDATE()" />


    2. Create an agent procedure and use step sqlRead to read 'Get Kaseya Server time' into a variable. That's the date and time from your Kserver's SQL server. You'll preumably then need to handle time zone offsets - the server offset you'll know, the agents offset you can get from #vAgentLabel.timezoneOffset# - and write a basic powershell one-liner to take all this info and set the time accordingly.

  • Create a file named GetDate.xml in the path "E:\Kaseya\xml\Procedures\AgentProcSQL\0\SQLRead" containing:

    <?xml version="1.0" encoding="UTF-8"?>  <queryList>  <queryDef sql="SELECT GETDATE()" label="DateTime Now"/> <queryDef sql="SELECT GETUTCDATE()" label="DateTime UtcNow"/></queryList>

    Then in an Agent Procedure, do a SQL Read and select one of the DateTime options.

    From there I would create a PowerShell script taking a single argument, the DateTime. I would parse it in PowerShell and then call time and date to set the time and date. Something off the top of my head, this should do it:



       [Parameter(Mandatory=$true, ValueFromPipeline=$true)]



    $split_sqlDate = $SqlDate.Split(' ')

    $split_date = $split_sqlDate[0].Split('-')

    $split_time = $split_sqlDate[1].Split(':')

    [int]$hours = [Int]::Parse($split_time[0])

    $ampm = 'AM'

    if ($hours > 12) {

       $hours = $hours - 12

       $ampm = 'PM'


    $sec = ($split_time[2].Split('.'))[0]

    $time = "$($hours):$($split_time[1]):$sec $ampm"

    $date = "$($split_date[1])/$($split_date[2])/$($split_date[0])"

    & cmd.exe /c time $time

    & cmd.exe /c date $date

    Definitely test that! If I were doing it, I would parse it into a DateTime object and then us ToString() with the format required, but I don't know that syntax off the top of my head. The above should work for your purpose though.

  • I have a strict network as well, and used this to create a procedure for syncing the date and time. Thanks!