Mixed success with RunAsCurrenUser and regedit

(imported topic written by SystemAdmin)

Ok, so I’m trying to remove some HKCU registry keys for a group of users. Im downgrading them from one version of Java to another. It works on about 1/2 of the PCs I’ve tried it on (Vista and XP). It does generate the .reg fine, but doesn’t seem to remove the keys. What’s odd is it worked on about 1/2 of the users.

Anyone see what I missed?

-Paul

Action looks like this:

if {exists current user}

prefetch RunAsCurrentUser.exe sha1:5512ef51a98dff1aa910a8189a0361c161fa703f size:212992 http://software.bigfix.com/download/bes/util/RunAsCurrentUser-2.0.2.exe

utility __Download\RunAsCurrentUser.exe

delete __appendfile

delete remove_oldjava_hkcu.reg

appendfile REGEDIT4

appendfile {("%0d%0a") of keys whose (default value of it as string as lowercase starts with “java plug-in” AND exists key “InprocServer32” whose ((it != “” AND not exists file (it as string)) of default value of it) of it) of key “Software\Classes\CLSID” of current user keys (logged on users) of registry}

appendfile {if (exists keys whose (name of it as lowercase starts with “javaplugin.”) of key “Software\Classes” of current user keys (logged on users) of registry) then (("%0d%0a") of keys whose (name of it as lowercase starts with “javaplugin.”) of key “Software\Classes” of current user keys (logged on users) of registry) else “”}

appendfile {if (exists key “Software\JavaSoft” of current user keys (logged on users) of registry) then "

-HKEY_CURRENT_USER\Software\JavaSoft

%0d%0a" else “”}

copy __appendfile remove_oldjava_hkcu.reg

waithidden __Download\RunAsCurrentUser.exe --w regedit -s remove_oldjava_hkcu.reg

(imported comment written by BenKus)

Hey Paul,

What relevance are you using?

And what happens on the systems that fail to run?

Ben

(imported comment written by SystemAdmin)

Hey Ben

Here’s the relevance…

((((if (name of operating system starts with “Win”) then platform id of operating system != 3 else false) AND (name of operating system as lowercase starts with “win”)) AND ((language of version block of file “kernel32.dll” of system folder contains “English”) OR (exists key “HKLM\System\CurrentControlSet\Control\Nls\MUILanguages” whose (exists value of it) of registry))) AND (not exists key “HKLM\Software\Wow6432Node\Microsoft\Windows\CurrentVersion” whose (exists value “ProductId” of it OR exists value “CommonFilesDir” of it) of registry AND not exists values “PROCESSOR_ARCHITECTURE” whose (it as string as lowercase = “ia64”) of keys “HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment” of registry)) AND (exists key whose (name of it starts with “{” and value “DisplayName” of it = “J2SE Runtime Environment 5.0 Update 11”) of key “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of registry) AND (exists key whose (default value of it as string as lowercase starts with “java plug-in” AND exists key “InprocServer32” whose ((it != “” AND not exists file (it as string)) of default value of it) of it) of key “Software\Classes\CLSID” of current user keys (logged on users) of registry)

Basically I’m downgrading a group of clients from Java 6.0 update 11 back to Java 5 update 11. The problem is that though Java 6 is uninstalled, there’s a number of CLSIDs stored in the user’s HKCU hive that still point to the files in the Java 6 folder (which no longer exists).

I’m locating keys that start with “Java Plug-In” that has a default value containg a path to a file that no longer exists. I tried re-writing it using HKEY_USERS, and oddly enough it’s not the same PCs reporting back. That’s a different issue.

Ok, on this one, the action creates the .reg file to remove the keys that need to be deleted. The .reg file does get created and it does appear that I am launching RunAsCurrentUser correctly. No errors on the PC, no failures on each line of the action. But eventually the fixlet does show failed, because it didn’t delete the entries. I can run regedit remotely, connect to the PC with the same user logged on and still see the registry keys present. It does match against the .reg file created. I can also manually delete the keys by hand.

So I’m not sure why this isn’t working on all PCs. I couldn’t get the Relevance Debugger working to test the relevance on an XP PC. I reported that in another forum post today (http://forum.bigfix.com/viewtopic.php?id=1098). Testing works under Vista, but under XP the “of cuurent users keys (logged on users) of registry” thinks I’m not logged on.

Paul

(imported comment written by BenKus)

Is it possible that the keys remain for other users of the system besides the keys for the user you deleted?

Ben

(imported comment written by SystemAdmin)

This is strange… I thought I replied to this yesterday.

Ok, anyhow, yes - it would be possible. However I did try this even on my own PC where I was logged in. The .reg file gets created fine, but regedit isn’t removing the registry values.

I think I found the issue with Vista. Launching regedit for a non-priv user works fine. But laucnhing regedit for a user whose a local admin kicks up the user access control when trying to run regedit. I’m guessing that’s what’s causing regedit not to run. I’m not sure how to get around this yet.

-Paul