Registry key with spaces

Benutzeravatar
SisterOfMercy
Beiträge: 1524
Registriert: 22 Jun 2012, 19:18

Registry key with spaces

Beitrag 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].
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!
Benutzeravatar
SisterOfMercy
Beiträge: 1524
Registriert: 22 Jun 2012, 19:18

Re: Registry key with spaces

Beitrag 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
:? :x :| maybe I should get some sleep first ;)
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!
Benutzeravatar
wolfbardo
uib-Team
Beiträge: 1354
Registriert: 01 Jul 2008, 12:10

Re: Registry key with spaces

Beitrag von wolfbardo »



OPSICONF 2024
https://opsi.org/en/opsiconf/

Basisworkshop Mainz :

17. - 20. 06. 2024


opsi support - uib gmbh
For productive opsi installations we recommend maintainance + support contracts which are the base of opsi development.

http://www.uib.de
Benutzeravatar
SisterOfMercy
Beiträge: 1524
Registriert: 22 Jun 2012, 19:18

Re: Registry key with spaces

Beitrag 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. :cry: :oops:
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
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!
r.witzel
Beiträge: 74
Registriert: 01 Aug 2011, 14:57
Wohnort: Melle

Re: Registry key with spaces

Beitrag 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
Carpe Opsi :)
Benutzeravatar
SisterOfMercy
Beiträge: 1524
Registriert: 22 Jun 2012, 19:18

Re: Registry key with spaces

Beitrag 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.
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!
Benutzeravatar
wolfbardo
uib-Team
Beiträge: 1354
Registriert: 01 Jul 2008, 12:10

Re: Registry key with spaces

Beitrag 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


OPSICONF 2024
https://opsi.org/en/opsiconf/

Basisworkshop Mainz :

17. - 20. 06. 2024


opsi support - uib gmbh
For productive opsi installations we recommend maintainance + support contracts which are the base of opsi development.

http://www.uib.de
Benutzeravatar
SisterOfMercy
Beiträge: 1524
Registriert: 22 Jun 2012, 19:18

Re: Registry key with spaces

Beitrag 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?
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!
Benutzeravatar
SisterOfMercy
Beiträge: 1524
Registriert: 22 Jun 2012, 19:18

Re: Registry key with spaces

Beitrag 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.
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!
Antworten