Seite 1 von 2
Registry key with spaces
Verfasst: 30 Sep 2013, 18:32
von SisterOfMercy
Hi,
I am working on a package and the logfile shows this:
Code: Alles auswählen
[6] [Sep 30 18:09:36:609] [xp64-custom] Executing cmd64.exe /c "reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\ActiveX Compatibility\{FE9E48A4-A014-11D1-855C-00A0C944138C} /f
[6] [Sep 30 18:09:36:625] [xp64-custom] ExitCode 1
[6] [Sep 30 18:09:36:625] [xp64-custom]
[6] [Sep 30 18:09:36:625] [xp64-custom] output:
[6] [Sep 30 18:09:36:625] [xp64-custom] --------------
[6] [Sep 30 18:09:36:625] [xp64-custom] ERROR: Invalid syntax.
[6] [Sep 30 18:09:36:625] [xp64-custom] Type "REG DELETE /?" for usage.
The corresponding command in setup.inf is this:
Code: Alles auswählen
deletekey [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\ActiveX Compatibility\{FE9E48A4-A014-11D1-855C-00A0C944138C}]
The key is indeed still in the registry. I think it has to do with the space in the registry key.
I tried this:
Code: Alles auswählen
deletekey "[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\ActiveX Compatibility\{FE9E48A4-A014-11D1-855C-00A0C944138C}]"
But that gets ignored alltogether. When changing an registry key there is no error, because reg.exe is not called or in a different way.
Of course I can workaround it, the "reg delete key" can be called from [winbatch].
Re: Registry key with spaces
Verfasst: 01 Okt 2013, 01:24
von SisterOfMercy
[winbatch] ?
Well.. that is not working.. Why....?
This is a clean installation, without an user having logged in previously.
Code: Alles auswählen
[4] [Sep 30 22:32:25:687] [xp64-custom] Warning: file not found :C:\WINDOWS\sysWOW64\regsvr32.exe - giving up
[4] [Sep 30 22:32:30:687] [xp64-custom] Warning: file not found :C:\WINDOWS\system32\reg.exe - giving up
Of course the command in setup.inf is made with %SystemRoot% like this:
Code: Alles auswählen
"%SystemRoot%\system32\reg.exe" delete "HKEY_CLASSES_ROOT\blahdeblah" /f

maybe I should get some sleep first

Re: Registry key with spaces
Verfasst: 02 Okt 2013, 14:01
von wolfbardo
Re: Registry key with spaces
Verfasst: 02 Okt 2013, 14:49
von SisterOfMercy
Sorry but I have read the manual pages you referred to five times now, and I can't see anything explained about registry paths like the one in my first message.
Other keys work fine. This key is also available in the 64-bit portion, and has the same result. Every key with a space in the name does not work, in the same way as this one.
This command works correctly from the command line:
Code: Alles auswählen
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\ActiveX Compatibility\{FE9E48A4-A014-11D1-855C-00A0C944138C}" /f
whereas this one will fail:
Code: Alles auswählen
reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\ActiveX Compatibility\{FE9E48A4-A014-11D1-855C-00A0C944138C} /f
The same commands do work when called from DosBatch;
This works fine when called from a 'DosBatch_reg winst /64Bit' command:
Code: Alles auswählen
"%SystemRoot%\system32\reg.exe" delete "HKEY_CLASSES_ROOT\Wow6432Node\MIME\Database\Content Type\application/x-shockwave-flash" /f
Re: Registry key with spaces
Verfasst: 04 Okt 2013, 08:23
von r.witzel
Hi,
the trick is to not use Windows tools to do registry actions.
Rather than using those you should refer to OPSI methods to manipulate the registry [2nd link]. They are way more reliable and accostumed to OPSI actions.
Futhermore there is a problem when using those Windows commands in a x64 environment because they exist in different directories (in comaparison to x86) to support native handling [they will still run - but throw errors]. I think this happens due to the fact that OPSI is running in x86 on x64.
To determine the correct path in batch use this bit (example is for "dism" but should also work with every other tool):
Code: Alles auswählen
if EXIST %WINDIR%\system32\dism.exe
(
set TOOLPATH=%WINDIR%\system32\dism.exe
)
if EXIST %WINDIR%\SysNative\dism.exe
(
set TOOLPATH=%WINDIR%\SysNative\dism.exe
)
%TOOLPATH% /online /Enable-Feature /FeatureName:TelnetClient
Best regards
Re: Registry key with spaces
Verfasst: 05 Okt 2013, 22:57
von SisterOfMercy
r.witzel hat geschrieben:the trick is to not use Windows tools to do registry actions.
Rather than using those you should refer to OPSI methods to manipulate the registry [2nd link]. They are way more reliable and accostumed to OPSI actions.
I know, I _am_ using the OPSI methods. But the deletekey command does not work correctly if the registry key has a space in it.
Re: Registry key with spaces
Verfasst: 07 Okt 2013, 17:26
von wolfbardo
try for instance
Code: Alles auswählen
Registry_deleteKey /32Bit
[Registry_deleteKey]
deletekey [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\ActiveX Compatibility\{FE9E48A4-A014-11D1-855C-00A0C944138C}]
regards,
bardo wolf
Re: Registry key with spaces
Verfasst: 07 Okt 2013, 19:08
von SisterOfMercy
wolfbardo hat geschrieben:try for instance
Code: Alles auswählen
Registry_deleteKey /32Bit
[Registry_deleteKey]
deletekey [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\ActiveX Compatibility\{FE9E48A4-A014-11D1-855C-00A0C944138C}]
Ok, that works.. The logfile looks quite different. So I tried the same with [Registry_deletekey2] which was called with the /64Bit modifier:
Code: Alles auswählen
[5] [Oct 07 18:26:49:046] [xp64-custom] Execution of Registry_deleteKey
[6] [Oct 07 18:26:49:046] [xp64-custom] Registry key [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\ActiveX Compatibility\{FE9E48A4-A014-11D1-855C-00A0C944138C}] opened
[6] [Oct 07 18:26:49:046] [xp64-custom] Key closed
[6] [Oct 07 18:26:49:046] [xp64-custom] Registry key [HKEY_LOCAL_MACHINE\] opened
[6] [Oct 07 18:26:49:046] [xp64-custom] SOFTWARE\Microsoft\Internet Explorer\ActiveX Compatibility\{FE9E48A4-A014-11D1-855C-00A0C944138C} deleted
[6] [Oct 07 18:26:49:046] [xp64-custom] Key closed
[5] [Oct 07 18:54:48:703] [xp64-custom] Execution of Registry_deleteKey2
[6] [Oct 07 18:54:48:703] [xp64-custom] Executing cmd64.exe /c "reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\ActiveX Compatibility\{FE9E48A4-A014-11D1-855C-00A0C944138C} /f
[6] [Oct 07 18:54:48:796] [xp64-custom] ExitCode 1
[6] [Oct 07 18:54:48:796] [xp64-custom]
[6] [Oct 07 18:54:48:796] [xp64-custom] output:
[6] [Oct 07 18:54:48:796] [xp64-custom] --------------
[6] [Oct 07 18:54:48:796] [xp64-custom] ERROR: Invalid syntax.
[6] [Oct 07 18:54:48:796] [xp64-custom] Type "REG DELETE /?" for usage.
[6] [Oct 07 18:54:48:796] [xp64-custom]
I thought OPSI was just calling reg delete for each and every key, but it is only doing that with the /64Bit modifier. But let me guess, without the /64Bit modifier it gets redirected to the Wow6432Node just like other 32-bit programs, right?
Re: Registry key with spaces
Verfasst: 08 Apr 2014, 20:42
von SisterOfMercy
BTW, where can I find the code for this part of OPSI?
I'm now here:
https://svn.opsi.org/listing.php?repnam ... 6542ce41b7
Have not yet found the code for the registry sections. I could install some software and learn how SVN works, but maybe this is quicker.
Re: Registry key with spaces
Verfasst: 08 Apr 2014, 21:51
von dkoch