public static void Set(string name)
        {
            var    regTimeZones = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones");
            var    subKey       = regTimeZones.GetSubKeyNames().Where(s => s == name).First();
            string daylightName = (string)regTimeZones.OpenSubKey(subKey).GetValue("Dlt");
            string standardName = (string)regTimeZones.OpenSubKey(subKey).GetValue("Std");

            byte[] tzi    = (byte[])regTimeZones.OpenSubKey(subKey).GetValue("TZI");
            var    regTzi = new RegistryTimeZoneInformation(tzi);

            TokenPrivilegesAccess.EnablePrivilege("SeTimeZonePrivilege");
            bool didSet;

            if (Environment.OSVersion.Version.Major < 6)
            {
                var tz = new TimeZoneInformation();
                tz.Bias         = regTzi.Bias;
                tz.DaylightBias = regTzi.DaylightBias;
                tz.StandardBias = regTzi.StandardBias;
                tz.DaylightDate = regTzi.DaylightDate;
                tz.StandardDate = regTzi.StandardDate;
                tz.DaylightName = daylightName;
                tz.StandardName = standardName;
                didSet          = TimeZone.SetTimeZoneInformation(ref tz);
            }
            else
            {
                var tz = new DynamicTimeZoneInformation();
                tz.Bias                        = regTzi.Bias;
                tz.DaylightBias                = regTzi.DaylightBias;
                tz.StandardBias                = regTzi.StandardBias;
                tz.DaylightDate                = regTzi.DaylightDate;
                tz.StandardDate                = regTzi.StandardDate;
                tz.DaylightName                = daylightName;
                tz.StandardName                = standardName;
                tz.TimeZoneKeyName             = subKey;
                tz.DynamicDaylightTimeDisabled = false;
                didSet = TimeZone.SetDynamicTimeZoneInformation(ref tz);
            }
            int lastError = Marshal.GetLastWin32Error();

            TokenPrivilegesAccess.DisablePrivilege("SeTimeZonePrivilege");
            if (!didSet)
            {
                if (lastError == TimeZone.ERROR_ACCESS_DENIED)
                {
                    throw new SecurityException("Access denied changing System TimeZone.");
                }
                else if (lastError == TimeZone.CORSEC_E_MISSING_STRONGNAME)
                {
                    throw new SystemException("Application is not signed.");
                }
                else
                {
                    throw new SystemException("Win32Error: " + lastError + "\nHRESULT: " + Marshal.GetHRForLastWin32Error());
                }
            }
        }
 private static extern bool SetDynamicTimeZoneInformation([In] ref DynamicTimeZoneInformation lpTimeZoneInformation);