12 Replies Latest reply on Mar 3, 2009 8:21 AM by steven.tolson

    Checking Windows vmware tools for time sync

    chadstanphill Lurker

       

      We have 100+ servers that we need to check to make sure they all have vmware tools set to get the time from the esx server. What's the best way to do this without checking each box.

       

       

      Thanks

       

       

        • 1. Re: Checking Windows vmware tools for time sync
          RParker Guru

          Use a group policy to push the NTP setting to the servers.  That's better than using the vmtools service.

          • 2. Re: Checking Windows vmware tools for time sync
            Kiil Novice
            vExpert

            Is this the prefered way to do it ?  I've read that it's "best practise" to turn off Windows time sync and use time sync within vmware tools...isn't this correct anymore ?

             

            Anyway, I've also got a lot of VM's running, and on a lot of them the time/clock is ahead of the time at the ESXi host.  By restarting the VMware tools service, the time is correct again...but after some time, the clock in the VM are ahead of the host again.  Why does this happen and how can I fix it ?

             

             

             

             

             

             

             

             

             

            /Kiil

            • 3. Re: Checking Windows vmware tools for time sync
              AWo Guru

              You can write a (Bash-) Script which add the line ' tools.syncTime = "TRUE" ' to every .vmx file.

               


              If you found this information useful, please consider awarding points for "Correct" or "Helpful" answers/replies. Thanks!!

              • 4. Re: Checking Windows vmware tools for time sync
                Kiil Novice
                vExpert

                Hmm...OK.  Do I have to reboot the VM after adding this to the vmx file ?

                • 5. Re: Checking Windows vmware tools for time sync
                  AWo Guru

                  I don't think so, as you can toggle this switch via the VMware Tools GUI while the guest is online. But it would be better to try it.

                   


                  If you found this information useful, please consider awarding points for "Correct" or "Helpful" answers/replies. Thanks!!

                  • 6. Re: Checking Windows vmware tools for time sync
                    Kiil Novice
                    vExpert

                    I've set up this for some VM's a while ago (weeks), but they still get ahead of the ESXi hosts clock.  VMware tools do not adjust the time if it's ahead of the host, only if it's behind.  So, why does the time go faster in the VM ? 

                     

                    If theres no solution/fix for this, I just have to restart VMware Tools Service once a week, but I think that's a dirty trick...

                    • 7. Re: Checking Windows vmware tools for time sync
                      AWo Guru

                      The first thing to do is to read this: http://www.vmware.com/pdf/vmware_timekeeping.pdf. It contains an explanation on how it all works and some troubleshooting hints.

                       

                      In fact, the VMware Tools can only advance the clock, not slow it down. At VMworld 2007 VMware said that this will be possible in future versions.

                       

                      The time can run faster if some kind of overcompensation happens. If your guest uses the PIT as its clock source it depends on interrupts to advance ist closk. But only the system which actually owns the CPU will receive this interrupts, so these are lost for all other systems. VMware keeps track of these lost interrupts and sens them to the guests which didn't see them in a compressed format. If the guest has its own compensation algorithm (because these lost interrupts occur on a physical system, too) it may lead to a clock which runs too fast, because the clock will be advanced by the later send lost interrupts and the compensation algorithm.

                      I'll never had that kind of problem with Windows, but very often with older Linux kernels.

                      The clock source the guest uses can change depending on what software you have installed. Some multimedia software for example changes the clock source.

                      In addition, running more than one time synchronization algorithm can also advance the clock too fast.

                      There might be more reasons than what I wrote here.

                       

                      Some KB Articles about time running too fast in Windowes guests:

                      KB 1002742

                      KB 1227

                      KB 1005953

                       


                      If you found this information useful, please consider awarding points for "Correct" or "Helpful" answers/replies. Thanks!!

                      • 8. Re: Checking Windows vmware tools for time sync
                        Kiil Novice
                        vExpert

                         

                        Thanks!  I'll read the PDF and see what I can do

                         

                         

                         

                         

                         

                        How to pin this as "Helpful" ?

                         

                         

                        • 9. Re: Checking Windows vmware tools for time sync
                          AWo Guru

                          Next to the posts of the users are the appropriate button.

                          • 10. Re: Checking Windows vmware tools for time sync
                            glynnd1 Expert

                            As always there are many ways of skinning a cat:

                            Script sample on how to check the syncTimeWithHost checkbox: http://communities.vmware.com/message/906987 using PowerShell

                            It also contains some details on how to disable the Windows Time service, which is important as you don't want to be looking at two different clocks.

                            • 11. Re: Checking Windows vmware tools for time sync
                              lamw Guru
                              Community WarriorsVMware Employees

                              Here is another VMware health check report you could run to get the status of you tools, version, timesync, etc.....

                               

                              http://communities.vmware.com/docs/DOC-9420

                               

                              I think the site hosting the images might be down right now, but you can check out the output to see what you would get.

                               

                               

                               

                               

                              =========================================================================

                              --William

                              VMware ESX/ESXi scripts and resources at: http://engineering.ucsb.edu/~duonglt/vmware/

                              • 12. Re: Checking Windows vmware tools for time sync
                                steven.tolson Enthusiast

                                I use a script to execute the following command on all Windows VM's every night:

                                 

                                VMwareService.exe --cmd "vmx.set_option synctime 0 1"

                                 

                                 

                                I've had problems with VM's 'losing' their VMtools time synch settings and this ensures they are all set to point to their host each night.

                                 

                                 

                                Also if you've got problems with time gain you could use the following command to do a one off time synch with the VM's domain:

                                 

                                 

                                net time /domain:<domain name> /set /yes

                                 

                                 

                                In our dev environment I use a script to do this on any VM's that have gained more than x seconds and all works well. The risk is if you have any applications/systems/auditors that are very time sensitive they may not like time suddenly jumping back in one go rather than being gradually corrected.

                                 

                                 

                                Hope this helps,

                                 

                                 

                                Steve