I run a batchfile via active setup. This batch file is adding .reg-files to the HKCU of the user (folder view-settings, etc).
The batchfile does it's job when I run manually as an user. When it's been started by active setup, the registry keys are not applied. For debugging I added "echo 1 > %temp%\1.log", which showed that the batchfile was started and each command line (eg "regedit /s HKCU_Remove_recent_from_startmenu.reg) was started as well.
Anybody any ideas?
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Answers

1
64 bit?
Answered 03/28/2012 by: dugullett
Red Belt

  • I had some trouble with this on one of our installs. I ended up creating an exe using Autoit that ran the reg keys. For whatever reason I had better luck running an exe rather the a reg file. Not sure if it was just my enviroment or not.
Please log in to comment
1
did you set your scripts working directory by starting it with

pushd "%~dp0"

If not, give it a try
Answered 03/28/2012 by: pjgeutjens
Red Belt

Please log in to comment
1
If we assume that you batch file and the reg files are in the same folder, try the following batch file:

[--Snip Start--]
@echo off

Set CURRDIR=%~dp0
Set LOG_FILE=%Temp%\Log.log

REG.exe IMPORT "%CURRDIR%HKCU_Alle_Folders_visible.reg" >> "%LOG_FILE%" 2>&1
Echo return: %ERRORLEVEL% >> "%LOG_FILE%"

REG.exe IMPORT "%CURRDIR%HKCU_set_screensave_reactivation_password.reg" >> "%LOG_FILE%" 2>&1
Echo return: %ERRORLEVEL% >> "%LOG_FILE%"

REG.exe IMPORT "%CURRDIR%HKCU_explorer_statusleiste visible.reg" >> "%LOG_FILE%" 2>&1
Echo return: %ERRORLEVEL% >> "%LOG_FILE%"

REG.exe IMPORT "%CURRDIR%HKCU_systemscontrol_small_icons.reg" >> "%LOG_FILE%" 2>&1
Echo return: %ERRORLEVEL% >> "%LOG_FILE%"

REG.exe IMPORT "%CURRDIR%HKCU_windows_explorer_folder_options.reg" >> "%LOG_FILE%" 2>&1
Echo return: %ERRORLEVEL% >> "%LOG_FILE%"

REG.exe IMPORT "%CURRDIR%HKCU_Remove_recent_from_startmenu.reg" >> "%LOG_FILE%" 2>&1
Echo return: %ERRORLEVEL% >> "%LOG_FILE%"
[--Snip End--]

Reg.exe gives a return code of 1 if it fails but regedit just returns zero in either case.

Hope this helps,
Daz.
Answered 03/28/2012 by: Daz
Orange Belt

Please log in to comment
1
use following in activesetup
reg.exe IMPORT \regfile.reg
Answered 03/29/2012 by: piyushnasa
Red Belt

  • Thanks piyushnasa, this is what I needed. My Active Setup was hanging because a UAC prompt is triggering when using REGEDIT ADD but REG IMPORT gets around it.
Please log in to comment
0
regedit /s HKCU_Remove_recent_from_startmenu.reg

start by taking out the /s and see if you get any error messages.
Answered 03/28/2012 by: pjgeutjens
Red Belt

Please log in to comment
0
Can you post code snippet of your batch file??
Answered 03/28/2012 by: akki
Fourth Degree Black Belt

Please log in to comment
-2
@dugullett: Yes, 64Bit
@pjgeutjens: You'll see nothing of that at all, cause the batch runs before the desktop is ready. When you redirect the output to a file (eg
regedit /s HKCU_Remove_recent_from_startmenu.reg > %temp%\logfile.log), it'll be empty
@akki: this is my batch:

[--Snip Start--]
@echo off
regedit /s HKCU_Alle_Folders_visible.reg
regedit /s HKCU_set_screensave_reactivation_password.reg
regedit /s HKCU_explorer_statusleiste visible.reg
regedit /s HKCU_systemscontrol_small_icons.reg
regedit /s HKCU_windows_explorer_folder_options.reg
regedit /s HKCU_Remove_recent_from_startmenu.reg
[--Snip END--]
Answered 03/28/2012 by: FerrisBueller
Senior Yellow Belt

  • @FerrisBueller:
    1. Have you given the proper path as in
    "%alluserspath%\HKCU_Remove_recent_from_startmenu" in your batch file, i dont
    see this in you batch file.
    2. If possible give it a try through VBScript.
Please log in to comment
Answer this question or Comment on this question for clarity