Marcel Henderik
(Fresh Scripter)
2003-10-19 04:18 PM
Change Daylight saving changes

hello,

i've got a little problem at my company..
i live in the nederlands and the clock uses Daylight saving changes. In the summer is it GMT +2 and in the winter is it GMT +1

but automatically adjustment is disabled on all my computers, so i created this script:

code:
 


If ExistKey ("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation") =0
$Autodaylight = ReadValue ("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation","DisableAutoDaylightTimeSet")
If $Autodaylight = "1"
DelValue ("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation","DisableAutoDaylightTimeSet")
WriteValue ("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation","DayLightName","W. Europe Daylight Time","Reg_SZ")
WriteValue ("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation","ActiveTimeBias","ffffff88","REG_DWORD")
WriteValue ("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation","DaylightBias","ffffffc4","REG_DWORD")
WriteValue ("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation","DaylightStart","00 00 03 00 05 00 02 00 00 00 00 00 00 00 00 00","REG_BINARY")

EndIf
EndIf




can anybody tell me of this will work??? i have to implement this next week.

by the way, if i adjust it manually, all appointments moves 1 hour forward...

thnx in regard,

marcel

message added for use with code button

[ 19. October 2003, 16:33: Message edited by: Marcel Henderik ]


Marcel Henderik
(Fresh Scripter)
2003-10-19 04:27 PM
Re: Change Daylight saving changes

PS,

the clients are Windows XP...


Kdyer
(KiX Supporter)
2003-10-19 04:27 PM
Re: Change Daylight saving changes

Marcel,

Please, when posting code, please use the CODE Button below to place your code between the [CODE]..[/CODE] tags.

Will this work?

What happens when you test it? Do your users have rights to do so? Generally speaking, HKLM, you would need Administrative access to write to this key of the registry.

With your DELVALUE, WRITEVALUE, etc. you should preceed the command with a $RC= or equivalent to suppress the results for your users. Having this off for the time being is good to see the results.

The REG_BINARY, should be -

"00000300050002000000000000000000"

HTH,

Kent


Marcel Henderik
(Fresh Scripter)
2003-10-19 04:32 PM
Re: Change Daylight saving changes

sorry,

next time i will use the code button..

all my users are at this time local admin so, that would not cause a problem.

when i run the script, the adjustment are made, but, my time will not jump one hour forward (still summertime), but when i made the adjustment manually, the time will jump...

quote:

The REG_BINARY, should be -

"00000300050002000000000000000000"


ok thnx. i will made the adjustment..

[ 19. October 2003, 16:34: Message edited by: Marcel Henderik ]


Marcel Henderik
(Fresh Scripter)
2003-10-19 04:54 PM
Re: Change Daylight saving changes

ok, when i press the OK button (de button with you see when you dubble click the time) after running the script, it will adjust the the time with one hour...

Marcel Henderik
(Fresh Scripter)
2003-10-19 06:24 PM
Re: Change Daylight saving changes

nobody any idea?

Les
(KiX Master)
2003-10-19 07:30 PM
Re: Change Daylight saving changes

Not sure what you expect... that is expected behaviour. Why would you expect the OS to react to a reg hack?

I imagine when the computer is rebooted, that it will have the correct time. You could try issueing a NET TIME or a W32TM -ONCE from the SHELL if you want to see results without a reboot.


Mart
(KiX Supporter)
2003-10-19 08:21 PM
Re: Change Daylight saving changes

A reboot should indeed do the trick, if all the correct settings are changed by your script. You can use some thing like regshot to check the values changed when you set it manually.

When this is enabled deploying some sort of auto time synchronization might also be a good thing.


Sealeopard
(KiX Master)
2003-10-19 09:05 PM
Re: Change Daylight saving changes

However, a registry refresh might do the trick, too. Registry refreshes are for example done when killing/restarting explorer.exe. See http://is-it-true.org/nt/registry/rtips315.shtml

Marcel Henderik
(Fresh Scripter)
2003-10-20 06:01 PM
Re: Change Daylight saving changes

Sorry, but even a reboot doen't do the trick..
also a resync of the time doens't doe the trick

why windows should accept this trick?? how else kan i make an ajustment with the time zone.

i acutally want te place just one ajustment with you're timezone information, cause my customer makes one huge mistake, 5 years ago....

ikm just a cleaner...


Kdyer
(KiX Supporter)
2003-10-21 07:01 AM
Re: Change Daylight saving changes

You can apply these changes by hand, right?

If we look at KiXtart FAQ & How to's

We see Registry Tools

and specifically Regshot

So, you should see the before and after effects and record these.

HTH,

Kent


Co
(MM club member)
2003-10-21 09:12 AM
Re: Change Daylight saving changes

Marcel,

You can also use Advanced Registry Tracert. Cann't you used the net time command?

[ 21. October 2003, 09:14: Message edited by: Co ]


Marcel Henderik
(Fresh Scripter)
2003-10-21 10:02 AM
Re: Change Daylight saving changes

i wish that nettime works, but it looks like he misses some adjusment..

wel, witg regshot i saw some more keys and values then i saw with regsnap (the tool witch i normally uses..)

code:
Values deleted:2 
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\TimeZoneInformation\DisableAutoDaylightTimeSet: 0x00000001
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation\DisableAutoDaylightTimeSet: 0x00000001


Values modified:8
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\TimeZoneInformation\DaylightName: "W. Europe Standard Time"
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\TimeZoneInformation\DaylightName: "W. Europe Daylight Time"
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\TimeZoneInformation\DaylightBias: 0x00000000
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\TimeZoneInformation\DaylightBias: 0xFFFFFFC4
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\TimeZoneInformation\DaylightStart: 00 00 0A 00 05 00 03 00 00 00 00 00 00 00 00 00
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\TimeZoneInformation\DaylightStart: 00 00 03 00 05 00 02 00 00 00 00 00 00 00 00 00
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\TimeZoneInformation\ActiveTimeBias: 0xFFFFFFC4
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\TimeZoneInformation\ActiveTimeBias: 0xFFFFFF88
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation\DaylightName: "W. Europe Standard Time"
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation\DaylightName: "W. Europe Daylight Time"
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation\DaylightBias: 0x00000000
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation\DaylightBias: 0xFFFFFFC4
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation\DaylightStart: 00 00 0A 00 05 00 03 00 00 00 00 00 00 00 00 00
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation\DaylightStart: 00 00 03 00 05 00 02 00 00 00 00 00 00 00 00 00
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation\ActiveTimeBias: 0xFFFFFFC4
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation\ActiveTimeBias: 0xFFFFFF88

im going to try those...

let you know wat happens,

ps, sorry for my english.... this costs me a lot of my regular sleep at night..


Co
(MM club member)
2003-10-21 11:09 AM
Re: Change Daylight saving changes

Well we could talk to each other in Dutch but there are +/- 5.000.000.000 - 21.000.000 people who cann't help you then. So don't worry about your english.... [Big Grin]

[ 21. October 2003, 11:50: Message edited by: Co ]


Marcel Henderik
(Fresh Scripter)
2003-10-22 12:25 AM
Re: Change Daylight saving changes

hehehe we really could, but i rather keep it in english so the that the others might try to understand me, but i FOUND my bug!!!!

code:
If ExistKey ("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation") =0
$Autodaylight = ReadValue ("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation","DisableAutoDaylightTimeSet")
If $Autodaylight = "1"
DelValue ("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation","DisableAutoDaylightTimeSet")
WriteValue ("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation","DayLightName","W. Europe Daylight Time","Reg_SZ")
WriteValue ("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation","ActiveTimeBias","0xFFFFFF88","REG_DWORD")
WriteValue ("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation","DaylightBias","0xFFFFFFC4","REG_DWORD")
WriteValue ("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation","DaylightStart","00000300050002000000000000000000","REG_BINARY")
Shell "%COMSPEC% /c net time \\server /set"
EndIf
EndIf

by DaylightBias it must be 0xFFFFFF88.. but i wrote: ffffff88.. well that doens't do the trick [Smile]

and that costed me almost a week.. pfff...
i uses the older version of regsnap and it gaves me the output i usses..ffffff88

thnx anybody for you're help!

now i need some more coffee.


Co
(MM club member)
2003-10-21 01:02 PM
Re: Change Daylight saving changes

MMM, I think you can laid back for the rest of the week since Wintertime starts next saturday... [Big Grin]

Marcel Henderik
(Fresh Scripter)
2003-10-21 01:27 PM
Re: Change Daylight saving changes

ghehhe allmost...
just need to find out why my server can't synchronise with a timeclock on the internet. [Frown]

problably a firewall rule... but therefore i need to contact the ISP.

then i take some rest [Smile]


Kdyer
(KiX Supporter)
2003-10-21 02:31 PM
Re: Change Daylight saving changes

Marcel,

You posted that 0xFFFFFF88 was the needed step..

Let's get some help from the documentation here.

If we do some digging under READVALUE...

"REG_DWORD variables are returned in decimal format"

Wouldn't that mean that these can also be written in Decimal Format?

For example, I see 4294967236 (FFFFFFC4) using Registry Commander.

So, we take your FFFFFF88 into Windows Calculator as a Hex and get 4294967176 in Decimal.

HTH,

Kent


Sealeopard
(KiX Master)
2003-10-21 05:42 PM
Re: Change Daylight saving changes

But you could also supply the HEX value instead, thus the &H moniker.

Marcel Henderik
(Fresh Scripter)
2003-10-22 07:51 PM
Re: Change Daylight saving changes

im not such a specialist in KIX... so [Smile]

but maybe it's strange but this works:

code:
  
If ExistKey ("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation") =0
$Autodaylight = ReadValue ("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation","DisableAutoDaylightTimeSet")
If $Autodaylight = "1"
DelValue ("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation","DisableAutoDaylightTimeSet")
WriteValue ("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation","DayLightName","W. Europe Daylight Time","Reg_SZ")
WriteValue ("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation","ActiveTimeBias","0xFFFFFF88","REG_DWORD")
WriteValue ("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation","DaylightBias","0xFFFFFFC4","REG_DWORD")
WriteValue ("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation","DaylightStart","00000300050002000000000000000000","REG_BINARY")
Shell "%COMSPEC% /c net time \\Testsrv /set"
EndIf
EndIf