How to get KiXtart to import HKCU settings for Windows 9X clients.

KiXtart is not able to update HKCU settings for Windows 9X clients with existing profiles. This is because Windows Explorer initializes only after KiXtart has completed and then loads the existing profile, thus nullifying any imported HKCU registry entries (the imported entries may be stored under HKEY_USERS\.DEFAULT though). To overcome this, have KiXtart create a key under HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce that will run regedit /s.


KiXtart runs:

IF @INWIN = 2 ; (Windows 9X client)
$RunOnce = CompareFileTimes("\\server\share\location\HKCU.reg", "%windir%\@userid_HKCU.txt")
   IF $RunOnce = 1 or $RunOnce = -3
   COPY "\\server\share\location\HKCU.reg" "%windir%\@userid_HKCU.txt"
   Shell "%windir%\Regedit /s \\server\share\location\RunOnce.reg"

The variable $RunOnce (that you create) is used with KiXtart's CompareFileTimes command to check to see if either the text file does not exist on the client or if the copy of the registry file on the server is newer.
If either of these conditions exists, the registry is updated and the registry file from the server is copied to the text file on the client's PC.
@userid is a native KiXtart variable. Using this will allow the text file to be user specific.

RunOnce.reg contains:


"RunOnce.reg"="regedit /s \\\\server\\share\\location\\HKCU.reg"

HKCU.reg contains (any HKCU settings you need):


[HKEY_CURRENT_USER\Control Panel\desktop]

[HKEY_CURRENT_USER\Control Panel\desktop\WindowMetrics]


Once KiXtart completes, Windows 9X finishes loading. The RunOnce registry key is executed and imports the HKCU settings from the registry file into the loaded profile.

You could also use KiXtart's WriteValue function to create the contents of what RunOnce.reg imports. In the above example:

WriteValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce","RunOnce.reg","regedit /s \\server\share\location\HKCU.reg","REG_SZ")
would replace
Shell "%windir%\Regedit /s \\server\share\location\RunOnce.reg".

The RunOnce.reg file is no longer used since what was imported from it is now written directly to the registry. Don't forget that writing to the HKCU area of the registry in Windows 9X is what the original problem really is, so you still need to use the HKLM\...\RunOnce registry key to load HKCU registry imports after Windows 9X initializes.