12 May 2015

Time testing: How to prevent time syncing

A common task when performing tests on data sets that vary over time is to advance the windows time.
The server or the workstation can however be part of a domain and the time is synced with it.
In this situation after the date/time is changed for the tests, the sync process will update them to the Domain Controllers value.
This will reset the date/time and the test environment is lost.

A question will then arise:
How to prevent time syncing with Domain Controllers?

The best solution that works in my test environment, is to change the registry key Type (REG_SZ value) located at
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters
The Type can have the following values:

Value

Description

NoSync

No Sync with Domain Controllers

Nt5DS

Sync with Domain Controllers

Note that the Nt5DS value is my configuration. Keep your Type value in the registry to restore to it.

The value can be updated with the registry editor (regedit) or by the command line, executing the following command:

Note that the value NoSync forces the time not being synced with the Domain Controllers. Change the value to you configuration to restore the time sync.

This solution is great, but be aware that if the server/workstation date/time gets out of sync with the Domain Controllers, authentication will fail and you can loose access to them.
While testing, keep the server/workstation logged-in so that you can keep the date/time in sync with the Domain Controllers.

To automated the process of setting the test ambient you can create a cmd file with:

Other Blogs

Disclaimer

1) The owner of this blog is not to be held responsible for any damage, loss or problem, including any interference or damage to a visitor’s computer, software or data, in relation to the use of this blog or it's content.
2) All the blog content is provided "as is" without warranty of any kind. Use it at your own risk. The owner of the blog is not to be held responsible for any loss or damage suffered by you or any third party .
3) All comments expressed by visitors are not endorsed by the owner of this blog.
4) The owner of this blog reserves the right to filter all published content, including comments.
5) All links provided at this blog are provided for the convenience of visitors. The owner of this blog is not to be held responsible for the content or use of these links.
6) The terms and conditions of this blog are subjected to change without prior notice.