<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>MCB Systems &#187; w32time</title>
	<atom:link href="http://www.mcbsys.com/techblog/tag/w32time/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mcbsys.com/techblog</link>
	<description>Custom Software and I.T. Services</description>
	<lastBuildDate>Mon, 06 Feb 2012 18:58:19 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Windows Time Stops Even When Set to Start Automatically</title>
		<link>http://www.mcbsys.com/techblog/2010/09/windows-time-stops-even-when-set-to-start-automatically/</link>
		<comments>http://www.mcbsys.com/techblog/2010/09/windows-time-stops-even-when-set-to-start-automatically/#comments</comments>
		<pubDate>Tue, 21 Sep 2010 00:33:11 +0000</pubDate>
		<dc:creator>Mark Berry</dc:creator>
				<category><![CDATA[IT Administration]]></category>
		<category><![CDATA[service trigger]]></category>
		<category><![CDATA[w32time]]></category>

		<guid isPermaLink="false">http://www.mcbsys.com/techblog/2010/09/windows-time-stops-even-when-set-to-start-automatically/</guid>
		<description><![CDATA[I’m running Windows Server 2008 R2 as a Hyper-V host. The domain controller runs as a guest. Following Microsoft&#8217;s recommendation, the host is not joined to the domain; it is a stand-alone workgroup client.
Even if you set Windows Time service to Automatic start, it stops within a few seconds. Why? How do you set up [...]]]></description>
			<content:encoded><![CDATA[<p>I’m running Windows Server 2008 R2 as a Hyper-V host. The domain controller runs as a guest. Following Microsoft&#8217;s recommendation, the host is not joined to the domain; it is a stand-alone workgroup client.</p>
<p>Even if you set Windows Time service to Automatic start, it stops within a few seconds. Why? How do you set up Windows Time to behave like it would on a domain client?</p>
<p><span id="more-438"></span></p>
<h3>Service Trigger Events:&nbsp; The Japanese Secret</h3>
<p>When I noticed that the Windows Time service wasn’t running, I found that it did in fact start when the system started, but then it stopped a few seconds later with this message:</p>
<p>Log Name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System<br />
Source:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Service Control Manager<br />
Event ID:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 7042<br />
Task Category: None<br />
Level:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Information<br />
Description:&nbsp;&nbsp; The Windows Time service was successfully sent a stop control. The reason specified was: 0&#215;40030011 [Operating System: Network Connectivity (Planned)]&nbsp; Comment: None</p>
<p>A Microsoft support rep pointed me to a Japanese knowledge base article that (with the help of Google Translate) lifts the veil on Windows Time behavior. In Windows 7 and 2008 R2, Windows Time additionally depends on <strong>service triggers</strong> to determine whether it keeps running.</p>
<p><a title="http://support.microsoft.com/kb/2385818/ja" href="http://support.microsoft.com/kb/2385818/ja">http://support.microsoft.com/kb/2385818/ja</a></p>
<p><a title="http://translate.google.com/translate?hl=en&amp;sl=ja&amp;u=http://support.microsoft.com/kb/2385818/ja" href="http://translate.google.com/translate?hl=en&amp;sl=ja&amp;u=http://support.microsoft.com/kb/2385818/ja">http://translate.google.com/translate?hl=en&amp;sl=ja&amp;u=http://support.microsoft.com/kb/2385818/ja</a></p>
<p>As you can see by typing</p>
<p><code>sc qtriggerinfo w32time</code></p>
<p>Windows Time is stopped if the computer is not domain joined.</p>
<p>I chose their workaround #2, to run Windows Time whenever a network is detected:</p>
<p><code>sc triggerinfo w32time start/networkon stop/networkoff</code></p>
<p><img style="display: inline; border-width: 0px;" title="Windows Time triggers" src="http://www.mcbsys.com/techblog/wp-content/uploads/2010/09/WindowsTimetriggers.png" border="0" alt="Windows Time triggers" width="554" height="327" /></p>
<h3>Background Research</h3>
<p>Here’s the boring background. Skip to the next section for the summary of how to set up Windows Time on a Hyper-V host running a domain controller guest.</p>
<p>At the bottom of the translated Japanese KB article, I saw reference to the Time Synchronization scheduled task. Here we see a task that starts the Time Service once a week. The <code>task_started</code> parameter apparently tells the service to start, sync the time, and stop.</p>
<p>Let’s compare stand-alone and domain-joined behavior, with the help of <a href="http://technet.microsoft.com/en-us/library/cc773263%28WS.10%29.aspx" target="_blank">this TechNet reference</a>.</p>
<p>In a stand-alone (non-domain-joined) machine, we have this setup for Windows Time:</p>
<p><strong>Type:</strong>&nbsp; NTP (uses manual peer)<br />
<strong>NtpServer:</strong>&nbsp; time.windows.com,0&#215;1 (0&#215;1 means use SpecialPollInterval)<br />
<strong>SpecialPollInterval:</strong>&nbsp; 604800 in seconds = 7 days<br />
Windows Time is set to Manual start.&nbsp; Even if set to Automatic, Windows Time service trigger stops service because not domain joined.<br />
Windows Time service started once a week by scheduled task, stops after time sync.</p>
<p>On a domain-joined machine, we have this setup for Windows Time:</p>
<p><strong>Type:</strong>&nbsp; NT5DS (uses domain controller; NtpServer and SpecialPollInterval have no effect; system determines polling frequency)<br />
<strong>MinPollInterval:</strong>&nbsp; 10 in Log(2) seconds = 2^10 = 1024 seconds = 17.1 minutes<br />
<strong>MaxPollInterval:</strong>&nbsp; 15 in Log(2) seconds = 2^15 = 32768 seconds = 546.1 minutes = 9.1 hours<br />
Windows Time service trigger does not stop service; Windows Time always running.<br />
Windows Time service started once a week by scheduled task, ends with 0&#215;420 ERROR_SERVICE_ALREADY_RUNNING.</p>
<h3>Set Up Windows Time on a Hyper-V Host Running a Domain Controller Guest</h3>
<p>If your Hyper-V host has a domain controller as a guest, here’s how to set up Windows Time. All commands apply to the host.</p>
<p>1. In Hyper-V Server Manager, go to the Settings for your domain controller guest and disable Time Synchronization. (This assumes the domain controller guest is configured properly to sync time with an external source.)</p>
<p><img style="display: inline; border: 0px;" title="Windows Time domain controller guest" src="http://www.mcbsys.com/techblog/wp-content/uploads/2010/09/WindowsTimedomaincontrollerguest1.png" border="0" alt="Windows Time domain controller guest" width="354" height="388" /></p>
<p>2. Open an administrative command prompt on the host and tell Windows Time to run as long as the network is available:</p>
<p><code>sc triggerinfo w32time start/networkon stop/networkoff</code></p>
<p>3. In services.msc, set Windows Time Startup Type to Automatic. Start the service.</p>
<p>4. Still at the command prompt, set Windows Time to retrieve time from the guest:</p>
<p><code>w32tm /config /manualpeerlist:<em>DC<var>_server_IP_Address</var></em>,0x8 /syncfromflags:MANUAL<br />
net stop w32time<br />
net start w32time<br />
w32tm /resync</code></p>
<h3>The Results</h3>
<p>After running those commands, we hopefully have a server that simulates a domain-joined client:</p>
<p><strong>Type:</strong>&nbsp; NTP (uses manual peer)<br />
<strong>NtpServer:</strong>&nbsp; <em>DC<var>_server_IP_Address</var></em>,0&#215;8 (0&#215;8 means act as client; system determines polling frequency)<br />
<strong>MinPollInterval:</strong>&nbsp; 10 in Log(2) seconds = 2^10 = 1024 seconds = 17.1 minutes<br />
<strong>MaxPollInterval:</strong>&nbsp; 15 in Log(2) seconds = 2^15 = 32768 seconds = 546.1 minutes = 9.1 hours<br />
Windows Time service trigger lets service run when network is connected, so Windows Time always running.<br />
Windows Time service started once a week by scheduled task, ends with 0&#215;420 ERROR_SERVICE_ALREADY_RUNNING.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mcbsys.com/techblog/2010/09/windows-time-stops-even-when-set-to-start-automatically/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>W32Time Errors in a Hyper-V Virtual Environment</title>
		<link>http://www.mcbsys.com/techblog/2010/08/w32time-errors-in-a-hyper-v-virtual-environment/</link>
		<comments>http://www.mcbsys.com/techblog/2010/08/w32time-errors-in-a-hyper-v-virtual-environment/#comments</comments>
		<pubDate>Fri, 27 Aug 2010 16:55:38 +0000</pubDate>
		<dc:creator>Mark Berry</dc:creator>
				<category><![CDATA[IT Administration]]></category>
		<category><![CDATA[hyper-v]]></category>
		<category><![CDATA[time sync]]></category>
		<category><![CDATA[w32time]]></category>

		<guid isPermaLink="false">http://www.mcbsys.com/techblog/2010/08/w32time-errors-in-a-hyper-v-virtual-environment/</guid>
		<description><![CDATA[I am running Small Business Server 2008 SP2 under Hyper-V. On a Server 2003 member server, also running under Hyper-V, I was getting frequent W32Time warnings errors in the System event log (Event IDs 38, 24, and 29 in that order).

Here are the event details. Note that the first one is recorded as an Information [...]]]></description>
			<content:encoded><![CDATA[<p>I am running Small Business Server 2008 SP2 under Hyper-V. On a Server 2003 member server, also running under Hyper-V, I was getting frequent W32Time warnings errors in the System event log (Event IDs 38, 24, and 29 in that order).</p>
<p><span id="more-408"></span></p>
<p>Here are the event details. Note that the first one is recorded as an Information event but actually indicates an issue.</p>
<p>Event Type:&nbsp;&nbsp;&nbsp; Information<br />
Event Source:&nbsp;&nbsp;&nbsp; W32Time<br />
Event Category:&nbsp;&nbsp;&nbsp; None<br />
Event ID:&nbsp;&nbsp;&nbsp; 38<br />
Description:<br />
The time provider NtpClient cannot reach or is currently receiving invalid time data from SBS2008Server.mydomain.local (ntp.d|192.168.1.25:123-&gt;192.168.1.2:123).</p>
<p>Event Type:&nbsp;&nbsp;&nbsp; Warning<br />
Event Source:&nbsp;&nbsp;&nbsp; W32Time<br />
Event Category:&nbsp;&nbsp;&nbsp; None<br />
Event ID:&nbsp;&nbsp;&nbsp; 24<br />
Description:<br />
Time Provider NtpClient: No valid response has been received from domain controller SBS2008Server.mydomain.local after 8 attempts to contact it. This domain controller will be discarded as a time source and NtpClient will attempt to discover a&nbsp; new domain controller from which to synchronize.</p>
<p>Event Type:&nbsp;&nbsp;&nbsp; Error<br />
Event Source:&nbsp;&nbsp;&nbsp; W32Time<br />
Event Category:&nbsp;&nbsp;&nbsp; None<br />
Event ID:&nbsp;&nbsp;&nbsp; 29<br />
Description:<br />
The time provider NtpClient is configured to acquire time from one or more time sources, however none of the sources are currently accessible.&nbsp; No attempt to contact a source will be made for 15 minutes. NtpClient has no source of accurate time.</p>
<h3>Analysis</h3>
<p>The SBS machine is the domain controller, so it’s also the default NTP server.</p>
<p>I had already followed <a href="http://blogs.technet.com/b/vikasma/archive/2008/07/24/hyper-v-best-practices-quick-tips-2.aspx" target="_blank">Hyper-V best practices for domain controllers</a> by disabling Time Synchronization and setting the SBS machine to sync with an external source. That’s working fine.</p>
<p>Client computers in the domain, both physical and virtual, were not reporting time sync errors even though they also get time from SBS (Type is NT5DS; see <a href="http://www.mcbsys.com/techblog/2010/05/check-windows-time-settings/" target="_blank">how to check this</a>). So why can’t Server 2003 sync time as well?</p>
<p>Microsoft KB <a href="http://support.microsoft.com/kb/875424" target="_blank">875424</a>, “Time synchronization may not succeed when you try to synchronize with a non-Windows NTP server in Windows Server 2003,” describes the symptoms pretty well except for the “non-Windows” part. But even after putting the Server 2003 machine into “client mode” (<strong>/syncfromflags:MANUAL</strong>) pointed directly at the domain controller, the time sync errors continued. So I set it back to domain mode (<strong>/syncfromflags:DOMHIER</strong>).</p>
<p>I turned on time service logging as described in Microsoft KB <a href="http://support.microsoft.com/kb/816043" target="_blank">816043</a>. Didn’t learn much here except that SBS is returning time packets with Precision: –6, so the <a href="http://www.mcbsys.com/techblog/2007/11/hotfix-lets-w32time-sync-with-very-high-precision-ntp-servers/" target="_blank">issue I had a few years ago</a> with very high precision servers is not the problem here.</p>
<h3>Solution</h3>
<p>Eventually I noticed that when starting the Windows Time Service, I would get an event indicating that time was being synchronized with the Hyper-V integration services provider:</p>
<p>Event Type:&nbsp;&nbsp;&nbsp; Information<br />
Event Source:&nbsp;&nbsp;&nbsp; W32Time<br />
Event Category:&nbsp;&nbsp;&nbsp; None<br />
Event ID:&nbsp;&nbsp;&nbsp; 35<br />
Description:<br />
The time service is now synchronizing the system time with the time source VM IC Time Synchronization Provider.</p>
<p>A little more Googling and I found <a href="http://serverfault.com/questions/24298/w32time-sync-problems-for-hyper-v-guests-w32time-event-ids-38-24-29-35" target="_blank">this article</a> suggesting that the solution is to disable Time Synchronization on <em>all</em> Hyper-V guests, not just on domain controllers. Once I disabled the Time Synchronization integration service on the Server 2003 machine and rebooted, the errors stopped.</p>
<p>I still don’t know why Hyper-V Time Synchronization integration service causes the standard domain-based time synchronization to fail (why not play nicely together?), but disabling Hyper-V Time Synchronization on all virtual machines seems to solve the problem.</p>
<h3>Bonus Tip:&nbsp; Time Sync on the Hyper-V Server</h3>
<p>All the machines above are running on Windows Server 2008 R2 as the Hyper-V host. Follow Microsoft’s recommendation, the host is <em>not</em> joined to the domain since the domain controller is running as a guest. To keep the host’s time in sync, I set it to client mode and pointed it at the SBS domain controller. This command sequence does the trick:</p>
<p><code>sc triggerinfo w32time start/networkon stop/networkoff<br />
</code><code>w32tm /config /manualpeerlist:<var>SBS_server_IP_Address</var>,0x8 /syncfromflags:MANUAL<br />
net stop w32time<br />
net start w32time<br />
w32tm /resync</code><code><br />
</code></p>
<p><strong>Note:</strong>&nbsp; If you get a message that the Windows Time service is not running, from <strong>services.msc</strong>, set it to Automatic and start it. For more details, see this <a title=" Windows Time Stops Even When Set to Start Automatically" href="http://www.mcbsys.com/techblog/2010/09/windows-time-stops-even-when-set-to-start-automatically/" target="_self">later blog post</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mcbsys.com/techblog/2010/08/w32time-errors-in-a-hyper-v-virtual-environment/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Hotfix Lets W32time Sync with Very High Precision NTP Servers</title>
		<link>http://www.mcbsys.com/techblog/2007/11/hotfix-lets-w32time-sync-with-very-high-precision-ntp-servers/</link>
		<comments>http://www.mcbsys.com/techblog/2007/11/hotfix-lets-w32time-sync-with-very-high-precision-ntp-servers/#comments</comments>
		<pubDate>Fri, 02 Nov 2007 10:34:00 +0000</pubDate>
		<dc:creator>Mark Berry</dc:creator>
				<category><![CDATA[IT Administration]]></category>
		<category><![CDATA[ntp]]></category>
		<category><![CDATA[w32time]]></category>

		<guid isPermaLink="false">/mark/post/Hotfix-Lets-W32time-Sync-with-Very-High-Precision-NTP-Servers.aspx</guid>
		<description><![CDATA[Time Server Upgrades Expose W32Time Bug&#160;
Some time ago, I set up two NTP time sources for my Windows 2003 / SBS 2003 domain controllers:&#160; time-nw.nist.gov in Redmond, Washington, and time-a.nist.gov in Gaithersburg, Maryland.
I noticed that the machines don&#8217;t ever seem to sync with time-nw.nist.gov. I keep getting W32Time errors:

Event ID: 38
&#8220;The time provider NtpClient cannot [...]]]></description>
			<content:encoded><![CDATA[<h1>Time Server Upgrades Expose W32Time Bug&nbsp;</h1>
<p>Some time ago, I set up two NTP time sources for my Windows 2003 / SBS 2003 domain controllers:&nbsp; time-nw.nist.gov in Redmond, Washington, and time-a.nist.gov in Gaithersburg, Maryland.</p>
<p>I noticed that the machines don&#8217;t ever seem to sync with time-nw.nist.gov. I keep getting W32Time errors:<br />
<span id="more-72"></span></p>
<p style="padding-left: 30px;">Event ID: 38<br />
&#8220;The time provider NtpClient cannot reach or is currently receiving invalid time data from time-nw.nist.gov&#8221;</p>
<p style="padding-left: 30px;">Event ID: 47<br />
&#8220;No valid response has been received from manually configured<br />
peer time-nw.nist.gov,0&#215;8 after 8 attempts to contact it.&#8221;</p>
<p>However, my second source, time-a.nist.gov, usually works, so the servers&#8217; times are still in sync:</p>
<p style="padding-left: 30px;">Event ID: 37<br />
&#8220;The time provider NtpClient is currently receiving valid time data from time-a.nist.gov&#8221;</p>
<p>I tried replacing&nbsp; time-nw.nist.gov with a couple other servers from the NIST&#8217;s <a href="http://tf.nist.gov/service/time-servers.html" target="_blank">list of public servers</a>, but the other two options failed as well. What&#8217;s going on here? Only one clock in the country works? Finally I came across<a href="http://channel9.msdn.com/ShowPost.aspx?PostID=300216" target="_blank"> this thread</a> on a Channel 9 forum.</p>
<p>On April 25, 2007, &#8220;PeterInSydney&#8221; turned on w32time logging (<a href="http://support.microsoft.com/kb/816043" target="_blank">here&#8217;s how</a>), and discovered that the w32time client was rejecting time with a &#8220;precision&#8221; value of -31. A Microsoft employee in Redmond, Matthew van Eerde, confirmed that this is a bug in the w32time client:&nbsp; &#8220;The w32time client incorrectly rejects packets with precision &lt; -30.&#8221; Van Eerde followed up on April 27 with a very helpful summary of what situations are broken (basically any XP or Win2003 machine trying to talk to a &#8220;very high-precision&#8221; server). The April 27 post mentions that, &#8220;Recently (March time frame) time.nist.gov became &#8216;very high<br />
precision.&#8217;&#8221; The workaround is to use a lower-precision server.</p>
<p>Sure enough, when I turned on w32time debugging on my server, I see that time-nw.nist.gov is also returning a -31 precision, whereas time-a.nist.gov is still &#8220;only&#8221; -30. That explains why only time-a.nist.gov is working.</p>
<p>Pardon the pun, but isn&#8217;t this a time bomb waiting to explode? So far I haven&#8217;t been able to find a list of which servers offer what level of precision. But if the NIST servers are gradually being upgraded to higher precision, won&#8217;t the Windows machines that rely on them eventually be left high and dry?</p>
<h1>The Hotfix&nbsp;</h1>
<p>Fortunately, reading further in the (four-page) Channel 9 thread, on September 4, Microsoft&#8217;s van Eerde announced that a<a title="The Windows Time service in Windows Server 2003 does not synchronize time with a time server if the precision value of the NTP response is less than -30" href="http://support.microsoft.com/kb/940742" target="_blank"> hotfix</a> for Windows Server 2003 is available:</p>
<p style="padding-left: 30px;">The Windows Time service in Windows Server 2003 does not synchronize time<br />
with a time server if the precision value of the NTP response is less than -30<br />
<a title="The Windows Time service in Windows Server 2003 does not synchronize time with a time server if the precision value of the NTP response is less than -30" href="http://support.microsoft.com/kb/940742" target="_blank">http://support.microsoft.com/kb/940742</a></p>
<p>So I submitted an<a title="Submit an online request to obtain a Microsoft hotfix" href="http://support.microsoft.com/kb/935195" target="_blank"> online hotfix request</a>, and in under two hours, the hotfix instructions arrived. Once applied and rebooted, time is now syncing properly with very high precision servers.</p>
<h1>Still Getting Errors&nbsp;</h1>
<p>Even though the Windows servers will now sync with very high precision NTP servers, I still sometimes get the 38 and 47 errors. Examing the debug log, this time it is due simply to the NTP server not responding to a query:</p>
<p style="padding-left: 30px;">Polling peer time-nw.nist.gov (ntp.m|0&#215;8|192.168.1.2:123-&gt;131.107.1.10:123)<br />
Sending packet to time-nw.nist.gov (ntp.m|0&#215;8|192.168.1.2:123-&gt;131.107.1.10:123) in Win2K detect mode, stage 1.<br />
No response from peer time-nw.nist.gov (ntp.m|0&#215;8|192.168.1.2:123-&gt;131.107.1.10:123).<br />
Logging information: NtpClient cannot reach or is currently receiving invalid time data from time-nw.nist.gov (ntp.m|0&#215;8|192.168.1.2:123-&gt;131.107.1.10:123).</p>
<p>So even though Windows is now able to handle high precision servers, you still have to find servers that are responsive. I never got time-nw.nist.gov to respond, and time.nist.gov was intermittent. Maybe w32time made too many requests and was blocked by the servers. In any case, I finally found two geographically separated NIST servers that are responding well. Here&#8217;s how I set them up (commands adapted from KB<a title="Time synchronization may not succeed when you try to synchronize with a non-Windows NTP server in Windows Server 2003" href="http://support.microsoft.com/kb/875424" target="_blank"> 875424</a>):</p>
<p>w32tm /config /manualpeerlist:&#8221;nist1.symmetricom.com,0&#215;8 time-b.timefreq.bldrdoc.gov,0&#215;8&#8243; /syncfromflags:MANUAL</p>
<p>net stop w32time</p>
<p>net start w32time</p>
<p>w32tm /resync</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mcbsys.com/techblog/2007/11/hotfix-lets-w32time-sync-with-very-high-precision-ntp-servers/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

