I need to delete a registry key from HKCU for the ActiveSync deployment I am working on. Easy enough with say Kix and DELKEY, but the Activesync software which creates the keys, randomly assigns one of the keys. Can a script be written to work out the full path to the key I want to delete, when a part of is different for every install.

One example is
HKCU\Software\Microsoft\Windows CE Services\Partners\497c4832\Services\Synchronization\Objects\Merlin Mail

The 497c4832 is the part that is random and Merlin Mail is the section I need to delete. If it helps there are no other keys created under Partners, though there are plenty of keys created with the lower sections.

The script could be kix or vbscript

Thanks in advance
0 Comments   [ - ] Hide Comments


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
Answer this question or Comment on this question for clarity


As I'm not familiar with neither kix nor vbscript, let me just point out my DOS way, maybe this will help anyway:

If there are no other Keys in Partners, we can list the content of partners and set a variable with that name. In DOS you can use:

FOR /F "delims=\ tokens=6" %%A in ('REG QUERY HKCU\Software\Microsoft\Windows CE Services\Partners') DO SET YOURVARIABLE=%%A

FOR /F goes through contents of the output of the command in brackets. The backslash is our delimiter and we want to evaluate the contents behind the sixth backslash. This will be set as YOURVARIABLE. This only works out right, when there is just one key below Partners, otherwise YOURVARIABLE will always be the last...

Then you can REG DELETE HKCU\Software\Microsoft\Windows CE Services\Partners\%YOURVARIABLE%\Services\Synchronization\Objects\Merlin Mail.

(sorry, no syntax checks when I typed this up, add quotes where needed)
Answered 07/29/2005 by: KPrinz
Fourth Degree Green Belt

Please log in to comment
Same concept in vbscript here:

Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002

Dim strComputer, sKey, sKeyPath
strComputer = "."

Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")

strKeyPath = "Software\Microsoft\Windows CE Services\Partners"
oReg.EnumKey HKEY_CURRENT_USER, strKeyPath, arrSubKeys

sKeyPath = "Software\Microsoft\Windows CE Services\Partners\"&sKey&"\Services\Synchronization\Objects\Merlin Mail"

oReg.DeleteKey HKEY_CURRENT_USER, strKeyPath
Answered 07/29/2005 by: TomB
Orange Belt

Please log in to comment
Thanks guys, thats helped a lot
Answered 08/04/2005 by: glwday
Orange Belt

Please log in to comment