0

I'm constructing a batch file that will auto-configure Windows 7's regional settings for all users.

So far, I've successfully been able to set (mostly) all of the regional settings for the current user, but I need to be able to apply the same settings to all new users. You can do this via the GUI, by going into Region and Language > Administrative > Copy Settings and selecting both checkboxes. I would like to do this programmatically, though. Does anyone know of a registry key I can set or something that will do this?

Failing that, I'll settle for a way to programmatically open the Region and Language > Administrative > Copy Settings window. I've been able to successfully open the Region and Language > Administrative window with start rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,3, but I would like to eliminate one more step from the process, if possible.

Update

Sorry, I seem to have forgotten to mention how I'm applying these settings. I'm doing this by executing an exported .reg file, that contains the optimal settings, with regedit.exe /s "regional.reg"

mythofechelon
  • 3,692
  • 11
  • 37
  • 48

1 Answers1

0

How are you applying the settings now? Via the registry?

If you put the settings under HKEY_USERS\.DEFAULT instead of (or in addition to) HKEY_CURRENT_USER, they should be used during profile creation.

Ben Voigt
  • 277,958
  • 43
  • 419
  • 720
  • I'm executing an exported `.reg` file with all the optimal settings via the batch file, as I find it easier that way. I, kind of, need to do it my way, as I need it set for the current user (local Admin, in this case) and then roll it out from there, if you see what I mean? – mythofechelon Jul 02 '12 at 13:18
  • @Ben: It should be a straightforward change to the .reg file to put settings into `HKEY_USERS\.DEFAULT`. – Ben Voigt Jul 02 '12 at 13:21
  • And that will set it for the current user and all future users? – mythofechelon Jul 02 '12 at 14:22
  • @Ben: That will set it for all user profiles created in the future (just like the checkbox). You already know how to set it for the current user. – Ben Voigt Jul 02 '12 at 14:34
  • Oh, I see. Okay, I've duplicated the keys and paths inside the `.reg` file, but changed `HKEY_CURRENT_USER\` to `HKEY_USERS\.DEFAULT\` for the second entry. I'll see if that works now. – mythofechelon Jul 02 '12 at 15:03
  • The keys are being set but the settings aren't being inherited by new users, even after restarting. I think it has to be done via "Copy Settings". So, back to square 1 it seems. :/ – mythofechelon Jul 02 '12 at 15:10
  • @BenHooper: This works for what you asked "apply the same settings to all new users", but that is the same as only one of the two checkboxes. For the other checkbox, you need to also apply the settings to `HKEY_USERS\S-1-5-18`, `HKEY_USERS\S-1-5-19`, and `HKEY_USERS\S-1-5-20` (check with regedit first to make sure your system uses the same numbers, but I think these are "well-known" SIDs). – Ben Voigt Jul 02 '12 at 16:22
  • Unfortunately, no luck. Applying exactly the same registry keys I use for `HKEY_CURRENT_USER\` (which works) to `HKEY_USERS\.DEFAULT\`, `HKEY_USERS\S-1-5-18\`, `HKEY_USERS\S-1-5-19\` and `HKEY_USERS\S-1-5-20\` didn't work with a new profile. Again, the keys were set in the registry but not inherited. – mythofechelon Jul 02 '12 at 22:03
  • @BenHooper: Can you use Process Monitor (SysInternals tool, which is now a division of Microsoft) to see what entries Windows writes to when you use the checkboxes? – Ben Voigt Jul 02 '12 at 23:20
  • I checked and it looks like all the above correspond to the "Welcome screen and system accounts" checkbox. I haven't hit the other, because the message suggests it makes a permanent change. – Ben Voigt Jul 02 '12 at 23:27
  • Yes, I did try ProcMon initially but, from what I could make out, it seemed to manually apply each key, which isn't ideal. Hence, me coming here to ask whether the checkbox itself had a registry key. Okay, that's not looking good then. How about simply opening the window? Any idea how to do that? :) – mythofechelon Jul 03 '12 at 07:46
  • @BenHooper: Even if the checkbox itself had a registry key, it's still just controlling an option on the action taken when you click "OK". Importing a registry file is not the same as clicking "OK", and won't run the logic that inspect the checkbox. The registry file will always make the changes contained inside, no more, and no less. It definitely should be possible to open that dialog automatically, but wouldn't it be easier to have a login script that imports the registry file? – Ben Voigt Jul 03 '12 at 12:18
  • Yes, but that way you'd only have to set one registry key, rather than accounting for loads. I try to avoid login scripts if possible. So, do you know the command to open the "Copy Settings" window? – mythofechelon Jul 03 '12 at 14:22
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/13369/discussion-between-ben-voigt-and-ben-hooper) – Ben Voigt Jul 03 '12 at 15:18