Reg Add Reg Delete Regedit /s in cmd file not working in K1000 offline script
I have a cmd and reg files in an offline script that is unzipped form the dependency dir to a folder on each 32 and 64 bit workstation.
In the cmd file I reg query (works) and if it finds the key reg adds a value (does not work). I have then tried regedit /s file.reg also (does not work).
Please help.
small samples of what I have tried:
REG ADD "HKLM\SOFTWARE\JavaSoft\Java Update\Policy" /v NotifyInstall /t REG_DWORD /d 0 /f
REG DELETE "HKLM\SOFTWARE\JavaSoft\Java Update\Policy" /v PromptAutoUpdateCheck /f
setlocal
set regpath0="HKLM\SOFTWARE\Policies\Adobe\Acrobat Reader\8.0"
reg query %regpath0% > nul
IF %errorlevel%==0 (
Echo 8.0 Found
REG ADD "HKLM\SOFTWARE\Policies\Adobe\Acrobat Reader\8.0\FeatureLockdown" /V "bUpdater" /t REG_DWORD /d 0 /f
)
or using regedit
"C:\Windows\regedit.exe" /s "C:\DSD\Installs\3rdPartyUpdatesOff\JavaAW7.reg"
setlocal
set regpath0="HKLM\SOFTWARE\Policies\Adobe\Acrobat Reader\8.0"
reg query %regpath0% > nul
IF %errorlevel%==0 (
Echo 8.0 Found
"C:\Windows\regedit.exe" /s "C:\DSD\Installs\3rdPartyUpdatesOff\AdobeR8.reg"
)
JavaAW7.reg
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Update\Policy]
"EnableJavaUpdate"=dword:00000000
"EnableAutoUpdateCheck"=dword:00000000
"NotifyDownload"=dword:00000000
"NotifyInstall"=dword:00000000
"PromptAutoUpdateCheck"=-
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft\Java Update\Policy]
"EnableJavaUpdate"=dword:00000000
"EnableAutoUpdateCheck"=dword:00000000
"NotifyDownload"=dword:00000000
"NotifyInstall"=dword:00000000
"PromptAutoUpdateCheck"=-
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"Adobe Reader Speed Launcher"=-
"Adobe ARM"=-
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run]
"Adobe Reader Speed Launcher"=-
"Adobe ARM"=-
Answers (1)
Can you set your "verify" to check for the registry entry. Then on "remediation" either change the registry key, or run a batch file wth regedit /s AdobeR8.reg. Make sure to upload the .reg as a dependency.
Comments:
-
This sounds like a typical 32-bit/64-bit problem to me. The KACE agent is a 32-bit process, so when it invokes $(KACE_SYS_DIR)\cmd.exe, it's a 32-bit environment you get for the batch file. So all the REG commands that use HKLM\SOFTWARE only "see" the 32-bit registry, so they will really be working under HKLM\SOFTWARE\Wow6432Node. And all the RegEdit commands will be seeing only the 32-bit registry as well.
The 32-bit/64-bit topic is too big to fully explain here. (I've begged KACE to do a KKE on it.) But here's the main trick: if you test for which bitness at the start of the batch file, you can have separate sections to handle 32-bit or 64-bit Windows. And, to force the batch file commands to work correctly in the 64-bit environment, run programs like REG.exe and REGEDT32.exe from C:\windows\sysnative, where the 64-bit programs appear to be, when you start from a 32-bit process. (Why did I say regedt32.exe instead of regedit.exe? Because there is no regedit.exe in sysnative!)
Want to really understand this 32-bit/64-bit stuff? Here is the $10 eBook version of a fabulous 1-day course on the topic: http://csi-windows.com/ebooks/windows-64-bit . I think every packager should take the 1-day course.
Or else KACE could give us a 64-bit KACE Agent for 64-bit Windows... :-) Sande - snissen 11 years ago