Time is off on PDC/DC server and how to fix it

We have had problems with HyperV and VMware hosts taking over the NTP role for our Primary domains controllers.

On VMware you first have to disable the timesync feature on all your virtual machines, you can do that be running this command.
c:\Program Files\VMware\VMware Tools\VMwareTools\VMwareToolsd.exe timesync disable

On HyperV you can just proceed to finding your PDC by opening your CMD and running netdom query fsmo.

Log on to your PDC and run these commands, in the manualpeerlist you can add the NTP servers for your location, to find NTP servers you can use http://www.pool.ntp.org.

w32tm /config /syncfromflags:manual /manualpeerlist:0.dk.pool.ntp.org,1.dk.pool.ntp.org,2.dk.pool.ntp.org,3.dk.pool.ntp.org /update

reg add HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Config /v SpecialInterval /t reg_dword /d 1 /f
reg add HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Config /v SpecialPollInterval /t reg_dword /d 60 /f

net stop w32time
net start w32time
w32tm /resync /force

On the other servers run these commands to set the intervals and force a sync.

reg add HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Config /v SpecialInterval /t reg_dword /d 1 /f
reg add HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Config /v SpecialPollInterval /t reg_dword /d 60 /f

w32tm /config /update
net stop w32time
net start w32time
w32tm /resync /force

To check if the settings is OK you can run w32tm /query /peers, which displays the servers you sync from which should be your PDC server on the other servers.

If not you can force a change by running the command w32tm /config /manualpeerlist:"dc1.contoso.local" "dc2.contose.local" /reliable:yes /
update.

I have tried one time that the time wouldn’t sync on the PDC even though I forced a sync, I then change the time 10 minutes back and resynced which helped.

 

Run Speedtest.net with PRTG Network Monitor – Updated 11-05-2018

Had a customer which needed to monitor their WAN connection and because we have PRTG Network Monitor which is such a cool tool btw, I though it would be easiest to integrate it.
zPeters on Github have created a really cool exe file which can speedtest your connection nice and easy with CMD, which is the file I use for testing.

I have created a .bat file which will run the speedtest .exe file and pass the data back to PRTG though an XML file.

Oh well, lets get to work.

  1. Create a .bat file and copy the following into it.

    @ECHO off
    SETLOCAL EnableDelayedExpansionSET "Ping="
    SET "Download="
    SET "Upload="
    FOR /F "tokens=4,5,6 delims=|" %%A IN ('"C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML\speedtest-64-v1.0.5.exe" -r') DO (
    SET Ping=%%A
    SET Download=%%B
    SET Upload=%%C
    )
    REM ** FOR /F "tokens=9 delims=:/ " %%A IN ('FINDSTR /I /C:"RTTS in" %tempfilename%') DO ( SET avg=%%A )
    REM ** FOR /F "tokens=10 delims=:/ " %%A IN ('FINDSTR /I /C:"RTTS in" %tempfilename%') DO ( SET max=%%A )
    REM ** FOR /F "tokens=11 delims=:/ " %%A IN ('FINDSTR /I /C:"RTTS in" %tempfilename%') DO ( SET dev=%%A )ECHO ^<^?xml version^=^"1.0^" encoding^=^"UTF-8^" ^?^>
    ECHO ^<PRTG^>
    ECHO ^<result^>
    ECHO ^<Channel^>Ping Latency^</Channel^>
    ECHO ^<value^>%Ping%^</value^>
    ECHO ^<Mode^>Absolute^</Mode^>
    ECHO ^<Unit^>TimeResponse^</Unit^>
    ECHO ^<Float^>1^</Float^>
    ECHO ^<ShowChart^>1^</ShowChart^>
    ECHO ^<ShowTable^>1^</ShowTable^>
    ECHO ^</result^>ECHO ^<result^>
    ECHO ^<Channel^>Download^</Channel^>
    ECHO ^<value^>%Download%00^</value^>
    ECHO ^<Mode^>Absolute^</Mode^>
    echo ^<volumeSize^>MegaBit^</volumeSize^>
    echo ^<float^>0^</float^>
    echo ^<unit^>SpeedNet^</unit^>
    ECHO ^<ShowChart^>1^</ShowChart^>
    ECHO ^<ShowTable^>1^</ShowTable^>
    ECHO ^</result^>ECHO ^<result^>
    ECHO ^<Channel^>Upload^</Channel^>
    ECHO ^<value^>%Upload%00^</value^>
    ECHO ^<Mode^>Absolute^</Mode^>
    echo ^<volumeSize^>MegaBit^</volumeSize^>
    echo ^<float^>0^</float^>
    echo ^<unit^>SpeedNet^</unit^>
    ECHO ^<ShowChart^>1^</ShowChart^>
    ECHO ^<ShowTable^>1^</ShowTable^>
    ECHO ^</result^>ECHO ^</PRTG^>
  2. Copy the .bat file onto your PRTG Server (not the client) in “C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML” or whatever your install directory is.
  3. Download zPeters Speedtest exe file from here: https://github.com/zpeters/speedtest/releases
    Remember to check that the newly downloaded .exe file matches the filename in the .bat file.
  4. Copy the newly downloaded .exe file to “C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML\” on your server.
  5. Go to your PRTG interface and add a new sensor for your client server, the sensor needs to be an EXE/Script Advanced.
  6.  Then that is added you should have something like this:PRTG Speedtest SensorPRTG Speedtest Sensor Graph

Update 2018: Some people have reported that the results is low, unfortunately I can’t reproduce the problem. With the newest version of Speedtest from zPeters, the results looks good.
This .bat script, only copies the results to PRTG from the Speedtest EXE. So if the results are low, then it might be the server you are testing againts like here: