cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Not applicable

vbScript to Uninstall a Prior app

Have a vbScript that works quite well when it is not in IS, but when I put it in as a Custom Action the script never locates the open Window and closes it. Can someone help out with this as I am kind of a deadline.

On Error Resume Next

Set objShell = CreateObject("WScript.Shell")

Dim returnCode

returnCode = objShell.Run("cmd /K CD " + Chr(34) + "%USERPROFILE%\Start Menu\Programs\Startup" + Chr(34)+" & del " + Chr(34)+"RealSign.appref-ms" + Chr(34),0, false)

objShell.Run "rundll32.exe dfshim.dll,ShArpMaintain RealSign.application, Culture=neutral, PublicKeyToken=dd392756883a4781, processorArchitecture=x86"



Do Until Success = True
Success = objShell.AppActivate("RealSign M")
If Success = True Then
objShell.SendKeys "+{TAB}"
objShell.SendKeys "{ENTER}"
Else
Sleep 200
End If
Loop

Set objShell = Nothing
Labels (1)
0 Kudos
(2) Replies
joshstechnij
Level 10 Flexeran
Level 10 Flexeran

The code in this custom action is unfortunately outside the scope of our expertise. As some general suggestions, have you tried any type of debugging such as placing message boxes to see where this code is executing or adding logging to see if the methods being called are returning expected values, etc.? This may help track down any differences between the working and non-working scenarios.

On a side note, running VBScript from Windows Installer custom actions is well known for not behaving the same as running through cscript or wscript (Windows Installer does not use these hosts to run the script). In addition, things like antivirus utilities can block these types of custom actions from running at all. Situations such as these can make debugging and support somewhat more difficult. In general, we would recommend C/C++ MSI DLL custom actions or just regular EXE actions, as they would typically be much easier to work with even though more initial development effort may be required.
0 Kudos
looeee
Level 8

the 1st thing i would do is to remove
On Error Resume Next
so you can get a proper error message. You'll find the error in the Windows Application Log
0 Kudos