HI,

I am working on an application called FSassist(Solvency) which is basically a xlsm file,which when clicked upon adds-in in Excel,when i unisntall this it leaves behing some registry entries under HKCU,(The unistal is clean for admin profile),

is there any way i can remove those entries during unistall?

any help would be really apprecited.

Thanks in advace.

Answer Summary:
Remove HKCU key using ActiveSetup
Cancel
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Answers

1

If these machines are in a domain create a GPO that deletes these keys on login since the key set is not read till excell is started

Answered 07/10/2012 by: SMal.tmcc
Red Belt

  • we ran into that when we uninstalled novell groupwise from our admin stations. An annoying popup came up everytime you started excell till we nuked the add on keys via GPO
Please log in to comment
1

Have you tried adding the Excel Add-in in HKLM than in HKCU in the same hive?

It can work for all users if set there.

Answered 07/10/2012 by: piyushnasa
Red Belt

  • The problem is MS's idea of add-ons. They see them as a per user item vs a machine item so when programs install the add-on for you they create the keys under hkcu.
Please log in to comment
1

HI giri,

Please find below the vb code that u may require to delete the HKCU keys.

Note:

1. The script is to be kept in a machine specific locations such as the AllusersAppdata folder (C:\ProgramData\).

2. The script can either be added using file table (need to mark that component permanent) or using the binary table.

3. This script is to be called using active setup as specified by other members here. Its the most safest and easiest method available.

4. Replace strValueDataSearch = <FILENAME.XLA> in the below code with the xla addin file name

5. This code also checks for different Excel versions installed so as to check in the correct registry hive ;)

 Option Explicit
On error resume next


Const IDOK = 1
Const IDCANCEL = 2
Const IDABORT = 3
Const IDRETRY = 4
Const IDIGNORE = 5

Const HKCU = &H80000001


Dim strComputer, objRegistry, strBaseKey, strSearch, strValueNameSearch, strValueDataSearch,objFSO, Os_Ver, objOS, intPrgPID, flag, Arr


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

set objFSO= createobject("scripting.filesystemobject")

Main

Function Main()
Call RemoveAddins1()
Main = IDOK
End Function



Function RemoveAddins1()

Dim arrValueNames, b, y, objExcel, objAddin, strValueData, a, x, strvalName, strOpen, intcount,strProgFiles,strExcel,objshell, strVer
intcount = 0
b=0
On Error Resume Next

Set objshell = Createobject("wscript.shell")



strExcel = "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Excel.Application\CurVer\"
strVer = objShell.RegRead(strEXcel)
If Instr(strVer,"11" ) Then
strBaseKey = "Software\Microsoft\Office\11.0\Excel\Options"
Elseif Instr(strVer,"12" ) Then
strBaseKey = "Software\Microsoft\Office\12.0\Excel\Options"

Elseif Instr(strVer,"14" ) Then
strBaseKey = "Software\Microsoft\Office\14.0\Excel\Options"

End If

strValueNameSearch = "open" 'Name of value to search for
strValueDataSearch = "<ADDIN FILENAME.XLA>" 'Value data search string - should always be in lower case


objRegistry.EnumValues HKCU, strBaseKey, arrValueNames

If Not IsNull(arrValueNames) Then

For y = 0 To UBound(arrValueNames)

If UBound(arrValueNames) > 1 Then


If InStr(LCase(Left(arrValueNames(y),4)), LCase(strValueNameSearch)) > 0 Then 'Get Values names

intcount=intcount + 1
objRegistry.GetStringValue HKCU, strBaseKey, arrValueNames(y), strValueData 'Get value data


strValueData = Mid(strValueData, 2,Len(strValueData)-2) 'Remove double quotesmsgbox strvaluedata


If InStr(LCase(strValueData), LCase(strValueDataSearch)) > 0 Then
objRegistry.DeleteValue HKCU, strBaseKey,arrValueNames(y)



For x = 0 To UBound(arrValueNames)

If InStr(LCase(Left(arrValueNames(x),4)), LCase(strValueNameSearch)) > 0 Then 'Get Values names

b = b + 1
If b = intcount+1 Then

objRegistry.GetStringValue HKCU, strBaseKey, arrValueNames(x), strValueData 'Get value data


strOpen= arrValueNames(x)

If b-2 = 0 Then
strvalName = Left (strOpen,4)
Else
strvalName = Left (strOpen,4) & CStr (b-2)
End If


objRegistry.SetStringValue HKCU, strBaseKey,strvalName, strValueData


objRegistry.DeleteValue HKCU, strBaseKey,arrValueNames(x)
intcount=intcount + 1
End If
End If


Next

End If
End If

Else


If InStr(LCase(Left(arrValueNames(y),4)), LCase(strValueNameSearch)) > 0 Then 'Get Values names


objRegistry.GetStringValue HKCU, strBaseKey, arrValueNames(y), strValueData 'Get value data


strValueData = Mid(strValueData, 2,Len(strValueData)-2) 'Remove double quotesmsgbox strvaluedata


If InStr(LCase(strValueData), LCase(strValueDataSearch)) > 0 Then


objRegistry.DeleteValue HKCU, strBaseKey,arrValueNames(y)

End If

End If


End If
Next

End If

End Function
Answered 07/11/2012 by: mitrokin
Senior Yellow Belt

  • What happens if someone double click this .vbs file in production environment before uninstallation of this package..

    Do not deliver this file during installation, Instead you can deliver it during uninstallation..
  • Or else you have to call this vbscript with some parameters... so that when someone double click this .vbs it will not remove the excel addin..
Please log in to comment
1

add lines to your script and use "reg.exe delete"

Answered 07/09/2012 by: SMal.tmcc
Red Belt

Please log in to comment
1

You have to remove those HKCU key using ActiveSetup

Answered 07/09/2012 by: jagadeish
Red Belt

  • Is this what you were referring to?
    http://www.itninja.com/blog/view/appdeploy-articles-activesetup
  • Yes.. Removing HKCU entries can not be done at the time of uninstallation itelf.. It has to be removed from all the user's HKCU registries..

    At the time of uninstallation, You have to create a Active Setup.. and deliver a VBScript which will remove HKCU registry keys for currently logged in user to any common location like C:\Windows...

    Your Active Setup should call your VBScript...

    This VBScript will remove the HKCU keys for every users on their next logon
  • Thanks, was trying to give some detail to your answer and did not want to miss-inform.
  • Thanks SMal.tmcc
Please log in to comment
1

You can make it easy on yourself and leave the keys behind - any harm in that?  Most of the time there’s nothing wrong with leaving old keys or old files after an uninstall has occurred.  They don’t affect the system without the app that uses them.

 

If you must remove them, you're in for a small challenge.  First you need to import the keys into the primary MSI so they already exist when the XLSM kicks on.  Next, you’ll have to add two Active Setups – one for the install and one for the uninstall.  For the install A.S, it’s the regular StubPath"="Msiexec.exe /fpu [ProductCode]"  but for the uninstall, you’ll have to add an A.S. using SMal.tmcc’s suggestion of REG DELETE with a condition to be run only on uninstall.

 

Answered 07/09/2012 by: vjaneczko
Seventh Degree Black Belt

  • You can not leave Excel Addin's HKCU registry keys on uninstall... otherwise it will prompt a warning message and irritate you whenever you launch excel after uninstall
  • we ran into that when we uninstalled novell groupwise from our admin stations. An annoying popup came up everytime you started excell till we nuked the add on keys
Please log in to comment
Answer this question or Comment on this question for clarity