[Samba] help - logon script

Mark Casey markc at unifiedgroup.com
Tue Mar 17 19:33:57 GMT 2009

Adam Williams wrote:
> have you put that regedit4 data into a file and ran it with regedit /s 
> time.reg in their login script?
> yudi shiddiq wrote:
>> Hello everybody...
>> I need help about logon script, this time i want to change time 
>> format from 12 format to 24 format on pc client.
>> I'm using samba 3.0.20 on PDC and the client is mostly win xp but we 
>> have pc with os win ME too.
>> I change from logon.exe that i put on every user directory which has 
>> script like this
>> [HKEY_CURRENT_USER\Control Panel\International]
>> "iTime"="1"
>> "sTimeFormat"="HH:mm:ss "
>> But when i try to login the time format doesn't change it still in 12 
>> format, i've tried many times but still the same.
>> Is there any clue...
>> I'm sorry if there is any mistake on my english.:)
>> Thx

Oooo yay a registry question. A few things to keep in mind, starting 
with the most obvious (some, I realize, you may already know...but I'm 
gonna paint with a wide brush).

1. The _CURRENT_USER hive of the registry is just that, per user. 
Changes to one user will not effect others.
> But when i try to login the time format doesn't change
If you set the script ONLY for your users and then YOU login with your 
own account that does not have the script, then it makes sense that your 
time would not change.

2. You do not need to leave these changes in the logon script. Once the 
change is actually made for each user, it should stick. Once it is 
working you can leave it there for a few weeks (until everyone has 
logged in) and then remove it.

3. You can modify  "[HKEY_USERS\.DEFAULT\Control Panel\International]" 
with your preferred settings, and all NEW users will inherit them in 
their HKCU.

4. Some settings in various versions of Windows are VERY hard to change 
via scripts. For example in WinXP, changing whether the Start menu 
hides, is locked, has quick launch, and etc is rather difficult. The 
reason is that Windows XP reads the settings into explorer.exe from the 
user's HKCU before your logon script can work, and writes them back at 
logoff; rendering scripts useless. (not to mention that all of those 
settings are globbed into one long binary string (50 characters or so) 
representing all of the settings).

I just tested the time settings on my Win XP Pro system and manual 
changes seem to be retained, and the time format did change when I 
logged back on...just be aware that Windows may be working against you 
(depending on the version and what you are trying to change, etc).

5. You can mount a user's HKCU as a subkey of HKLM even when they are 
logged off. Open HKLM and go to File-> load hive. Choose the user's 
ntuser.dat file (usually C:\documents and settings\USERNAME\ntuser.dat). 
This can be invaluable for investingating things or for changing 
settings like the ones I described in #4. (In fact, deciphering the long 
binary string for the start menu settings and writing a program to 
enumerate all the users, mount their ntuser.dat, and make the change 
when they are not logged in is the only way I've seen #4 done.)

Other than that, try what others have suggested here. Make sure the time 
format is actually changing when you merge the .reg manually or manually 
edit the registry. Also note that there is the command line REG command 
that can be used to work with individual keys, should your command line 
merge method never work.


More information about the samba mailing list