I just came across this last night because I needed the same thing. I used a WMI query to get what I needed. You'll need to add System.Management.dll to your references, then use the following code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Management;
using System.Data;
namespace DeleteMeConsole
{
class Program
{
static void Main(string[] args)
{
bool trusted = true;
if (trusted)
{
GetTimeZone("", "", "myServer");
}
else
{
GetTimeZone("myUserName", "myPassword", "myServer");
}
}
private static void GetTimeZone(string loginName,string userPassword, string serverName)
{
try
{
ManagementScope Scope;
if (loginName.Trim().Length > 0)
{
ConnectionOptions Conn = new ConnectionOptions();
Conn.Username = loginName;
Conn.Password = userPassword;
Conn.Authority = "ntlmdomain:DOMAIN";
if (Conn.Username.IndexOf(@"\") > 0)
{
int delimiterLocation = loginName.IndexOf(@"\");
string domainName = loginName.Substring(0, delimiterLocation);
string eventUserName = loginName.Substring(delimiterLocation + 1);
Conn.Username = eventUserName;
Conn.Authority = "ntlmdomain:" + domainName;
}
Scope = new ManagementScope(String.Format("\\\\{0}\\root\\CIMV2", serverName), Conn);
}
else
Scope = new ManagementScope(String.Format("\\\\{0}\\root\\CIMV2", serverName), null);
Scope.Connect();
ObjectQuery Query = new ObjectQuery("SELECT * FROM Win32_TimeZone");
ManagementObjectSearcher Searcher = new ManagementObjectSearcher(Scope, Query);
foreach (ManagementObject WmiObject in Searcher.Get())
{
Console.WriteLine("{0,-35} {1,-40}", "Bias", WmiObject["Bias"]);
Console.WriteLine("{0,-35} {1,-40}", "Caption", WmiObject["Caption"]);
Console.WriteLine("{0,-35} {1,-40}", "DaylightBias", WmiObject["DaylightBias"]);
Console.WriteLine("{0,-35} {1,-40}", "DaylightDay", WmiObject["DaylightDay"]);
Console.WriteLine("{0,-35} {1,-40}", "DaylightDayOfWeek", WmiObject["DaylightDayOfWeek"]);
Console.WriteLine("{0,-35} {1,-40}", "DaylightHour", WmiObject["DaylightHour"]);
Console.WriteLine("{0,-35} {1,-40}", "DaylightMillisecond", WmiObject["DaylightMillisecond"]);
Console.WriteLine("{0,-35} {1,-40}", "DaylightMinute", WmiObject["DaylightMinute"]);
Console.WriteLine("{0,-35} {1,-40}", "DaylightMonth", WmiObject["DaylightMonth"]);
Console.WriteLine("{0,-35} {1,-40}", "DaylightName", WmiObject["DaylightName"]);
Console.WriteLine("{0,-35} {1,-40}", "DaylightSecond", WmiObject["DaylightSecond"]);
Console.WriteLine("{0,-35} {1,-40}", "DaylightYear", WmiObject["DaylightYear"]);
Console.WriteLine("{0,-35} {1,-40}", "Description", WmiObject["Description"]);
Console.WriteLine("{0,-35} {1,-40}", "SettingID", WmiObject["SettingID"]);
Console.WriteLine("{0,-35} {1,-40}", "StandardBias", WmiObject["StandardBias"]);
Console.WriteLine("{0,-35} {1,-40}", "StandardDay", WmiObject["StandardDay"]);
Console.WriteLine("{0,-35} {1,-40}", "StandardDayOfWeek", WmiObject["StandardDayOfWeek"]);
Console.WriteLine("{0,-35} {1,-40}", "StandardHour", WmiObject["StandardHour"]);
Console.WriteLine("{0,-35} {1,-40}", "StandardMillisecond", WmiObject["StandardMillisecond"]);
Console.WriteLine("{0,-35} {1,-40}", "StandardMinute", WmiObject["StandardMinute"]);
Console.WriteLine("{0,-35} {1,-40}", "StandardMonth", WmiObject["StandardMonth"]);
Console.WriteLine("{0,-35} {1,-40}", "StandardName", WmiObject["StandardName"]);
Console.WriteLine("{0,-35} {1,-40}", "StandardSecond", WmiObject["StandardSecond"]);
Console.WriteLine("{0,-35} {1,-40}", "StandardYear", WmiObject["StandardYear"]);
}
}
catch (Exception e)
{
Console.WriteLine(String.Format("Exception {0} Trace {1}", e.Message, e.StackTrace));
}
Console.WriteLine("Press Enter to exit");
Console.Read();
}
}
}