1

We have some users in our company who need to use additional Keybaords, in order to achieve this one of the other admins had written a VBS script which runs when users in a particular group log in to the machine (this is set as part of a GPO applied to these users).

Recently some users joined this group who needed keyboards in additional languages, so I added some extra fields to the script. The new script appears to work fine on a machine that has never had a keyboard set in this way, but for those machines that someone logged in on with the old keyboard script, the keyboards set by that script are still enforced, none of the additional keyboards seem to be applied to the new machine.

Here is the script that I am trying to use:

Dim WshShell                   
Set WshShell = WScript.CreateObject("WScript.Shell")
'Portugese
WshShell.RegWrite "HKCU\Keyboard Layout\Preload\2", "00000816", "REG_SZ"
'Japanese
WshShell.RegWrite "HKCU\Keyboard Layout\Preload\3", "00000411", "REG_SZ"
'Japanese
WshShell.RegWrite "HKCU\Keyboard Layout\Preload\4", "e0010411", "REG_SZ"
'Chinese
WshShell.RegWrite "HKCU\Keyboard Layout\Preload\5", "00000804", "REG_SZ"
'Chinese
WshShell.RegWrite "HKCU\Keyboard Layout\Preload\6", "e00e0804", "REG_SZ"
'Arabic Libya
WshShell.RegWrite "HKCU\Keyboard Layout\Preload\7", "0000040c", "REG_SZ"
'German
WshShell.RegWrite "HKCU\Keyboard Layout\Preload\8", "00000407", "REG_SZ"
'Swedish
WshShell.RegWrite "HKCU\Keyboard Layout\Preload\9", "0000041d", "REG_SZ"
'Spanish
WshShell.RegWrite "HKCU\Keyboard Layout\Preload\10", "0000040a", "REG_SZ"
WshShell.RegWrite "HKCU\Software\Microsoft\CTF\LangBar\ShowStatus", 0, "REG_DWORD"
WshShell.RegWrite "HKCU\Software\Microsoft\CTF\LangBar\ExtraIconsOnMinimized ", 1, "REG_DWORD"
WshShell.RegWrite "HKCU\Software\Microsoft\CTF\LangBar\Label", 1, "REG_DWORD"
WshShell.RegWrite "HKCU\Software\Microsoft\CTF\LangBar\Transparency", 0, "REG_DWORD"

If I look at regedit on a machine that does not display the new keyboards in the language bar, and go into HKEY_USERS, the .DEFAULT has a Keyboard Layout which only lists the default UK keyboard. But when I log a user in to the machine, a new entry appears in HKEY_USERS at the bottom and that lists off the 3 keyboards which appear on the language bar (but not the others that were later added to the VBS above). I have tried editing the strings for this entry, this has no affect, after a reboot the change I made disappears (I have to do this from my machine with regedit as the user has no ability to get to these settings).

I have also tried adding an additional keyboard to the .DEFAULT user key, and that doesn't help either after a reboot.

Is there a way to make the machine forget all of the keyboard settings which have been applied, so that the next time someone logs in it uses those defined in this script? Or is there something missing in the script that could make the machine forget the old settings?

At the moment, the only way I believe will work would be to reinstall the machine, which is probably overkill to fix missing keyboards and not practical when there are 20 machines that need this fixing and additional keyboards could be requested in the future.

Any help appreciated!

Cadoiz
  • 135
  • 5
Rumbles
  • 915
  • 1
  • 12
  • 27

1 Answers1

0

I ended up changing a few options in there and ended up with this:

Dim WshShell                   
Set WshShell = WScript.CreateObject("WScript.Shell")
'German
WshShell.RegWrite "HKCU\Keyboard Layout\Preload\2", "00000407", "REG_SZ"
'Japanese
WshShell.RegWrite "HKCU\Keyboard Layout\Preload\3", "00000411", "REG_SZ"
'Chinese
WshShell.RegWrite "HKCU\Keyboard Layout\Preload\4", "00000404", "REG_SZ"
'Swedish
WshShell.RegWrite "HKCU\Keyboard Layout\Preload\5", "0000041d", "REG_SZ"
'Spanish
WshShell.RegWrite "HKCU\Keyboard Layout\Preload\6", "0000040a", "REG_SZ"
'Portugese
WshShell.RegWrite "HKCU\Keyboard Layout\Preload\7", "00000816", "REG_SZ"
WshShell.RegWrite "HKCU\Software\Microsoft\CTF\LangBar\ShowStatus", 4, "REG_DWORD"
WshShell.RegWrite "HKCU\Software\Microsoft\CTF\LangBar\ExtraIconsOnMinimized", 1, "REG_DWORD" 
WshShell.RegWrite "HKCU\Software\Microsoft\CTF\LangBar\Label", 1, "REG_DWORD"
WshShell.RegWrite "HKCU\Software\Microsoft\CTF\LangBar\Transparency", ff, "REG_DWORD"
Rumbles
  • 915
  • 1
  • 12
  • 27