Hello, I need to import something like this to registry: Code: [HKEY_USERS\S-1-5-21-916612875-1494325352-2862801814-1001\Control Panel\Keyboard] "InitialKeyboardIndicators"="2" However the number "916612875-1494325352-2862801814-1001" is different in each Windows installation. So I need the hint from somebody for VBS script, which will retrieve the correct number from the registry 1st and then do the import. Thanks.
Yep, but when I try to import to HKCU, the values are generally synced to S-1-5-21-xxx after the reboot and for example in this particular case the reboot also clears the value in HKCU before it is synced to S-1-5-21-xxx.
You mention the value clears after the reboot. Is this because you are running it in a setupcomplete.cmd? If so, i have some tricks that may help. The problem is HKCU values don't stick after the reboot. However, the old "RunOnceEx" trick works and i use it to run a firstlogon from setupcomplete.cmd after the first reboot that basically just runs HKCU reg entries. I use a different non-cmd way, but in cmd form i think its... Code: :RunOnceEx SET KEY=HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnceEx REG DELETE %KEY% /f cls Echo. & Echo Add RunonceEX & Echo. REG ADD %KEY% /f REG ADD %KEY% /V TITLE /D "RunOnceEx Applications" /f REG ADD %KEY% /V Flags /t REG_DWORD /d "20" /f if %PROCESSOR_ARCHITECTURE% == x86 ( If Exist %windir%\setup\Firstlogon\Firstlogon.exe REG ADD %KEY%\0010 /VE /D "Run Firstlogon.exe" /f If Exist %windir%\setup\Firstlogon\Firstlogon.exe REG ADD %KEY%\0010 /V 1 /D "%windir%\setup\Firstlogon\Firstlogon.exe" /f ) else ( If Exist %windir%\setup\Firstlogon\Firstlogon_x64.exe REG ADD %KEY%\0010 /VE /D "Run Firstlogon_x64.exe" /f If Exist %windir%\setup\Firstlogon\Firstlogon_x64.exe REG ADD %KEY%\0010 /V 1 /D "%windir%\setup\Firstlogon\Firstlogon_x64.exe" /f ) rundll32.exe iernonce.dll,RunOnceExProcess goto :eof As for the changing value, i love figuring out tricks like this. If it were me, i would do something along the lines of retrieving the value with maybe a stdout, and then on the fly writing a reg file from scratch with a >null regfile.reg type trick, and then run reg import to the created .reg file. This can be done with the runonce trick above, or by having a cmd in the startup folder in the start menu that runs the reg and self deletes. I know how to do all this easy enough with autoit but not sure with vbs or cmd.