views:

425

answers:

2

Ok,

I've got a problem here with an MSI deployment that I'm working on (using Installshield) we have a program running in the background that needs to run per-user, this needs to start automatically without user intervention.

The problem is with GPO/AD deployment the application is started in the SYSTEM context before anyone is logged in rather than as the user who is about to log in. The application can only run once per user, and it seems that the SYSTEM process prevents the USER process from starting. This means the PCs need to be rebooted twice before the software can be deployed to the users. Any ideas how to stop this?

Basically the current workflow is:

  1. Installation/upgrade runs... kill background app
  2. install new files
  3. Startup background application

this works for Published applications and interactive MSI installations - it's only 'Assigned' applications that seem to have the problem. As step 3 happens in the SYSTEM context rather than the user context :(

Ideally I'd have the development team patch the EXE to prevent launching in the SYSTEM context, but that's a release cycle away and I'm looking for an installer based solution for the interim.

(Edit: I don't know Installscript... so I'm guessing VBscript is probably the way to if there's no native Installshield stuff I can use)

+2  A: 

You can use the LogonUser property of Windows Installer as a condition to the action launching the EXE.

On Freund
Just added this in our latest release (replacing my code below) - Works like a charm! Thanks :)
sascha
would be great if you could explain how to do this in more detail.
Patrick Klug
A: 

AHA! I knew there had to be a cleaner solution... the code I was working on was starting to look something like this:

On Error Resume Next 
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
    ("Select * from Win32_Process Where Name = 'BackgroundProcess.exe'")
For Each objProcess in colProcessList
    colProperties = objProcess.GetOwner(strNameOfUser,strUserDomain)
    If strNameOfUser = "SYSTEM" Then    
        objProcess.Terminate()
    End If
Next
sascha