Luke R
Luke R

Reputation: 97

How to Turn off Windows 7 Internet Time Sync Using C#?

Windows 7 Internet Time

Hello all,

How would I go about turning off automatic internet time synchronization using C#?

I know I can turn it off by going to (Adjust Date & Time -> Internet Time) but I need to do it through C#. Maybe a registry key change?

Thanks much! Luke

Upvotes: 2

Views: 1593

Answers (1)

Luke R
Luke R

Reputation: 97

I figured it out:

try
{
   Registry.SetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters",
   "Type", "NoSync", RegistryValueKind.String);
}
catch
{
    Console.WriteLine("Could not change internet time sync. Registry error!!!");
}

Upvotes: 3

Related Questions