Active SetUp
Hey guys,
Most of you will be very much aware of the issues with using Active SetUp....
I have been using an active setup when an application has user-profile related entries and no shortcut / file extension to trigger a self-heal.....
After using these apps in several users and uninstalling it, I have been getting issues for other associated apps because of the HKCU entries it leaves behind...
I tried placing a .vbs file permanently on the machine (to delete these registries) and write another active seup at uninstall to this .vbs file...
But still i get issues at installing and uninstalling for the second time(as the HKCU active setup is available already as it in created during the first run)...........
I finally managed to close the issue by placing the .vbs file permanently on the machine (to delete these registries)and write an entry in "HKLM\software\MS\Windows\Current version\Run" during uninstall. On installing the app again, it will check for this entry and remove it if present.
I can very well see that this is not the best way to handle this issue... How do you guys manage apps that has user-profile related files/regs.... especially for roaming profiles [:o] %^$*# !!!!????????????
Thanks,
Rajesh.
Most of you will be very much aware of the issues with using Active SetUp....
I have been using an active setup when an application has user-profile related entries and no shortcut / file extension to trigger a self-heal.....
After using these apps in several users and uninstalling it, I have been getting issues for other associated apps because of the HKCU entries it leaves behind...
I tried placing a .vbs file permanently on the machine (to delete these registries) and write another active seup at uninstall to this .vbs file...
But still i get issues at installing and uninstalling for the second time(as the HKCU active setup is available already as it in created during the first run)...........
I finally managed to close the issue by placing the .vbs file permanently on the machine (to delete these registries)and write an entry in "HKLM\software\MS\Windows\Current version\Run" during uninstall. On installing the app again, it will check for this entry and remove it if present.
I can very well see that this is not the best way to handle this issue... How do you guys manage apps that has user-profile related files/regs.... especially for roaming profiles [:o] %^$*# !!!!????????????
Thanks,
Rajesh.
0 Comments
[ + ] Show comments
Answers (16)
Please log in to answer
Posted by:
talalsamih
9 years ago
Hi guys i am Mohamed Talal from morocco,
i had the same issue uninstalling and leaning the HKCU users entries, i wrote .cmd script that cleans all HKCU entries easily :D
here is the script
for /f %i in ('dir /b c:\users') do reg load hklm\%i "c:\users\%i\NTUSER.DAT"
for /f %i in ('dir /b c:\users') do reg delete "HKEY_LOCAL_MACHINE\%i\Software\Apple Inc."
for /f %i in ('dir /b c:\users') do reg unload hklm\%i
good luck
Comments:
-
Do you have a solution for roaming profiles as this will only work for local profiles.?? - EdT 9 years ago
-
i will query for the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList key in order to get to list of all profiles that have logged into the machine and then i will loop through in order to load their reg hives and do the changes in them - talalsamih 9 years ago
-
How will you do this when the profiles are not on the machine because they are roaming profiles which are deleted from the local machine when the user logs out. - EdT 9 years ago
-
OK :-D then.
What i will do is a reg query on
reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\user SID" /v Centralprofile
in odrder to get the centralized profile location and then access the NTUSER.DAT in order to modify it in the way i want.
after these modifications the user needs to close and reopen his session in order to allow windows to get a fresh copy of his NTUSER.DAT HIVE.
;) !
i will give you to full script - talalsamih 9 years ago-
...and which account will you use to do this, as if you are running the script with the LocalSystem account (eg SCCM) then it has no access to the network, and if you run as a current user, it will not have access to other user's profiles. The only realistic solution is to embed domain admin credentials into the script, which you network security grunts will rip you to pieces for....:-)) - EdT 9 years ago
-
You are right ;). - talalsamih 9 years ago
-
We are not going to embed admin account in the script but well grant the SCCM SYSTEM ACCOUNT the right to access the netwokr user profiles share - talalsamih 9 years ago
Posted by:
spartacus
15 years ago
If you want to reinstate the Active Setup behaviour when you reinstall the package, an easier method would be to increment the "Version" value on your Active Setup registry entry.
For example, if you have the following registry value defined
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{<Some GUID>}\Version
and the value of this is currently set to 1,0,0,0
then changing the contents of this value to 1,0,0,1 before reinstalling the package would mean the Active Setup would be triggered again when new users logon to the system.
This would of course mean that you are left with residual HKCU Active Setup entries for previous installations, but if you can live with that, then this method is simpler IMHO.
Regards,
Spartacus
For example, if you have the following registry value defined
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{<Some GUID>}\Version
and the value of this is currently set to 1,0,0,0
then changing the contents of this value to 1,0,0,1 before reinstalling the package would mean the Active Setup would be triggered again when new users logon to the system.
This would of course mean that you are left with residual HKCU Active Setup entries for previous installations, but if you can live with that, then this method is simpler IMHO.
Regards,
Spartacus
Posted by:
revizor
15 years ago
Posted by:
athirukk
15 years ago
I have the same scenario. I reinstall (not upgrade) my package with some registry changes in HKCU and I increase the AS Version value in HKLM, so that other users of the machine will see Active Setup gets triggered when the log in.
My problem is, the modified reg entry done while Reinstall is not getting reflected in other users HKCU. Any workarounds? Custom Action script?
My problem is, the modified reg entry done while Reinstall is not getting reflected in other users HKCU. Any workarounds? Custom Action script?
Posted by:
rayz_0020
15 years ago
@ Graham
Do you mean i should edit and modify my package before every reinstall ????
If that is the case I am afraid i cant' use this....
@ Paul
A DeleteRegistries.vbs is installed on the machine during app install and it is marked permanent.
During Install:
Delete (If present):
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\[ProductName]
Value : "C:\..............\DeleteRegistries.vbs
Write:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\[ProductCode]
Value: msiexec /fup [ProductCode] /qn
During UnInstall:
Delete :
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\[ProductCode]
Value: msiexec /fup [ProductCode] /qn
Write:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\[ProductName]
Value : "C:\..............\DeleteRegistries.vbs
If you want to reinstate the Active Setup behaviour when you reinstall the package, an easier method would be to increment the "Version" value on your Active Setup registry entry.
Do you mean i should edit and modify my package before every reinstall ????
If that is the case I am afraid i cant' use this....
@ Paul
Because if you don't remove those entries, how would your computer know not to apply Active Setup routines for new users?
A DeleteRegistries.vbs is installed on the machine during app install and it is marked permanent.
During Install:
Delete (If present):
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\[ProductName]
Value : "C:\..............\DeleteRegistries.vbs
Write:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\[ProductCode]
Value: msiexec /fup [ProductCode] /qn
During UnInstall:
Delete :
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\[ProductCode]
Value: msiexec /fup [ProductCode] /qn
Write:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\[ProductName]
Value : "C:\..............\DeleteRegistries.vbs
Posted by:
spartacus
15 years ago
ORIGINAL: rayz_0020
@ Graham
If you want to reinstate the Active Setup behaviour when you reinstall the package, an easier method would be to increment the "Version" value on your Active Setup registry entry.
Do you mean i should edit and modify my package before every reinstall ????
If that is the case I am afraid i cant' use this....
Well the way I would see this typically working is that the package, should perform a search for
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\[ProductName]\Version
(You can use the System Search wizard if you use InstallShield or the equivalent in Wise Package Studio for this).
You would then introduce a short custom action such that if a version value is found, it would increment it and set a property to the new value.
If a version value is not found, but the Active Setup key exists, then the custom action should set the property to (say) 1,0,0,1
Either way, the property just mentioned could then be used in the Registry table to populate the Active Setup Version field.
So yes, it would involve modifying the package as a "one-off", but it should be fairly future proof in this thereafter. It would also mean that you could drop your deleteregistries.vbs.
Regards,
Spartacus
Posted by:
jbar
15 years ago
ORIGINAL: spartacus
You would then introduce a short custom action such that if a version value is found, it would increment it and set a property to the new value.
If a version value is not found, but the Active Setup key exists, then the custom action should set the property to (say) 1,0,0,1
Spartacus
Do you have a sample of such a custom action? I'm not sure how I would increment 1,0,0,0 to 1,0,0,1
Thanks
Jeff
Posted by:
MsiCreator
15 years ago
Hi all did any one find any solution for the above problem.
If I try to increment 1,0,0,0 by 1 it becomes 1001(Without comma)
Also,Do you have any idea why only string values are used as version rather than Dword value.
Possible reason as I observed ; is Dword value is not written in HKCU key while string can be written.
However we are still struggling to know the reason behind this behavior.
If I try to increment 1,0,0,0 by 1 it becomes 1001(Without comma)
Also,Do you have any idea why only string values are used as version rather than Dword value.
Possible reason as I observed ; is Dword value is not written in HKCU key while string can be written.
However we are still struggling to know the reason behind this behavior.
Posted by:
anonymous_9363
15 years ago
If I try to increment 1,0,0,0 by 1 it becomes 1001(Without comma)Presumably you mean you're incrementing it in script? I can't see any other way that that would happen. Thus, the script is probably the culprit. Post the code and we'll see if we can help. Remember to use the CODE tag, accessible by clicking the button marked '<%'.
Also,Do you have any idea why only string values are used as version rather than Dword value.A question for Microsoft, I think. A lot of the registry's implementation makes no sense. Why, for example, are class names "divorced" from their class IDs? Why HKCR\Classes\[GUID] plus HKCR\Classes\Class.Name and not HKCR\Classes\Class.Name\[GUID] ('Class.Name' first because apps use that, not the class ID, to locate objects)? That's never made sense to me
is Dword value is not written in HKCU key while string can be writtenThe HKCU hive is no different to any other hive and can accept all registry data types.
Posted by:
MsiCreator
15 years ago
Thanks vbscab for quick reply.
Code of vb script is
Code of vb script is
Option Explicit
On Error Resume Next
Dim WSHShell, RegKey, DName, Result, sTmpPath, ActVer, pcode, pname, ActVer1
Set WSHShell = CreateObject("WScript.Shell")
pcode = SESSION.PROPERTY("ProductCode")
pname = SESSION.PROPERTY("ProductName")
sTmpPath = """" & WSHShell.ExpandEnvironmentStrings("%allusersprofile%") & "\Application Data\XLAaddinRemove.vbs"""
WSHShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\" + pcode + "\", + pname
WSHShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\" + pcode + "\StubPath", sTmpPath
ActVer = "10,0,0,3802"
ActVer = WSHShell.regRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{22d6f312-b0f6-11d0-94ab-0080c74c7e95}" + "\Version")
msgbox ActVer
if ActVer >= 0 then
ActVer = ActVer + 1
end if
WSHShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{22d6f312-b0f6-11d0-94ab-0080c74c7e95}" + "\Version", ActVer
Set WSHShell = Nothing
Posted by:
karshi
15 years ago
Also regarding
However if we keep it as string value the key gets replicated in HKCU as well which can be helpful for any other implementation such as to increment the active setup version etc.
The HKCU hive is no different to any other hive and can accept all registry data types.our our observation is if we keep version key as Dword; the version key will not get replicated in HKCU hive.
However if we keep it as string value the key gets replicated in HKCU as well which can be helpful for any other implementation such as to increment the active setup version etc.
Posted by:
anonymous_9363
15 years ago
Your problem is here:
Even if the interpreter were to coerce the integer to a string, it becomes "0". Either way, the test won't resolve to True.
You need to treat the return value totally as a string. I'd use Split to divide the string into manageable "chunks", something like:
You need to correct what looks to me like an error, where you set ActVer explicitly (ActVer = "10,0,0,3802"). The line immediately following will make that variable empty if the registry value is empty. Try
- you MUST use 'Option Explicit' when writing VB/VBA/VBS
- I prefer Hungarian notation for variable-naming and I try avoid using shortened names. Thus, instead of 'ActVer', use 'strActiveSetupVersion'.
- add error-trapping to EVERY stage. Code should always assume that nothing will work as expected, even instantiation of common objects like WScript.Shell.
if ActVer >= 0 thenActVer returns with a string but your test is for it being greater than or equal to an integer, i.e. 0 (let's leave out the philosophy discussion as to whether or not zero is an integer...)
Even if the interpreter were to coerce the integer to a string, it becomes "0". Either way, the test won't resolve to True.
You need to treat the return value totally as a string. I'd use Split to divide the string into manageable "chunks", something like:
strMajorVersion = Split(ActVer, ",")(0)
strMinorVersion = Split(ActVer, ",")(1)
strBuildVersion = Split(ActVer, ",")(2)
strReleaseVersion = Split(ActVer, ",")(3)
Convert each version to integer (CInt) (having made sure the value is numeric first, of course) then test if adding '1' will push the version over 10 (or whatever you decide is the limit for each chunk). If it does, increment the chunk to its left using the same logic (although not necessarily the same limit) and so on. If it doesn't, proceed to writing the new value.You need to correct what looks to me like an error, where you set ActVer explicitly (ActVer = "10,0,0,3802"). The line immediately following will make that variable empty if the registry value is empty. Try
ActVer = WSHShell.regRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{22d6f312-b0f6-11d0-94ab-0080c74c7e95}" + "\Version")
If Len(ActVer) = 0 Then
ActVer = "10,0,0,3802"
End If
My usual caveats apply: - you MUST use 'Option Explicit' when writing VB/VBA/VBS
- I prefer Hungarian notation for variable-naming and I try avoid using shortened names. Thus, instead of 'ActVer', use 'strActiveSetupVersion'.
- add error-trapping to EVERY stage. Code should always assume that nothing will work as expected, even instantiation of common objects like WScript.Shell.
Posted by:
turbokitty
15 years ago
Posted by:
MsiCreator
15 years ago
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.