Hi Colin,
If you are using a SAPGUI Installation Server to push out the upgrade (which is the recommended route to follow), then the upgrade should detect and kill running instances on the workstation without you having to specially code anything yourself, or at least this is my understanding from the documentation. But perhaps you are using too low of a patch? Patch 2 is very old. GUI 7.40 is up to at least patch 9 (that's what we are using), and the SAPSetup program itself (used by the Installation Server) is beyond patch 78 (what we have). I would ensure you have at least these patch levels.
That said, Dan's code should work if it is inserted into a Package Event Script within your Installation Server. If you aren't using an Installation Server -- well, then, really you should, but if you aren't -- you could use some external VBscript to close the process. I have used the following for running upgrades at my location -- bear in mind, the script needs to "run as administrator" if it is outside of an Installation Server, so it has to start with that:
Set oWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
If WScript.Arguments.length = 0 Then 'Restart script as Administrator
If strOSVersion = "6." Or strOSVersion = "10" Then
Set objApp = CreateObject("Shell.Application")
objApp.ShellExecute "wscript.exe", """" & WScript.ScriptFullName & """" & " RunAsAdministrator", , "runas", 1
End If
Else 'do the work
Set colProcess = oWMI.ExecQuery ("Select * from Win32_Process Where Name = 'saplogon.exe'")
For Each objProcess in colProcess
Return = objProcess.Terminate()
Next
End If 'Close out the ELSE statement
Cheers,
Matt
Message was edited by: Matt Fraser (first attempt got garbled)