Announcement

Collapse
No announcement yet.

VB Scripting within an MSI

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • VB Scripting within an MSI

    Hey all, I've been frequenting this forum for a very long time now and it has been a great resource (thanks)

    I now have an issue of my own that I can't seem to find an answer too.


    I have a MSI that I have placed two vbscripts into to have them run prior to installation.
    everything works correctly until I run in /passive mode. at this point only the 'kill process' script executes, the uninstaller never runs.
    the uninstall is set to run immediately after the 'kill process' completes. I've pasted both below - i would greatly appreciate any pointers/fixes as to why the uninstall isn't working when the MSI is run passive.

    'KILL PROCESS'

    Option Explicit
    Dim objWMIService, objProcess, colProcess
    Dim strComputer, strProcessKill
    strComputer = "."
    strProcessKill = "'MDTAppPortal.exe'"

    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" _
    & strComputer & "\root\cimv2")

    Set colProcess = objWMIService.ExecQuery _
    ("Select * from Win32_Process Where Name = " & strProcessKill )
    For Each objProcess in colProcess
    objProcess.Terminate()
    Next


    'Uninstall'
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

    Set colSoftware = objWMIService.ExecQuery _
    ("Select * from Win32_Product Where Name = 'MDT Application Portal'")

    For Each objSoftware in colSoftware
    objSoftware.Uninstall()
    Next
Working...
X