/build/static/layout/Breadcrumb_cap_w.png

Software Deployment Question


Is there any way to query the Windows Installer to see if its in use?

03/21/2012 2852 views
Hi all,

Is there any way to check if the Windows Installer is already "installing" something?

Thanks!

Lewis
Answer Summary:
U can use this script '===================================== 'Begin: WaitIfSetupRunning ' '===================================== Private Sub WaitIfSetupRunning Dim SetupRunning:SetupRunning=False do until SetupRunning Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & "." & "\root\cimv2") Set colProcesses=objWmiService.ExecQuery ("Select * From Win32_Process Where Name='msiexec.exe'") If (colProcesses.Count>0) Then For Each objProcess In colProcesses If (Instr (objProcess.Commandline,"/V")=0) Then Sleep 2000 Exit For Else If (colProcesses.Count=1) Then _ SetupRunning=True End If Next Else SetupRunning=True End If Loop End Sub '================================== 'Begin: Sleep ' ' This subroutine pauses script ' execution for specified amount of ' time in miliseconds. '================================== Private Sub Sleep (intTime) objShell.Run "ping 1.1.1.1 -n 1 -w " & intTime,0,True End Sub '================================== 'End: Sleep '==================================
0 Comments   [ + ] Show comments

Comments



Community Chosen Answer

5
not sure if this is correct, but think there is a flag in the registry at HKLM\Software\Microsoft\Windows\Current Version\Installer\InProgress

can you confirm that?
Answered 03/22/2012 by: RaginX
Orange Belt

  • Good find @RaginX
    I indeed does make the above specified entry, giving the location of MSI from which it is being executed.

All Answers

1
Hey Lewis
U can use this script

'=====================================
'Begin: WaitIfSetupRunning
'
'=====================================


Private Sub WaitIfSetupRunning
Dim SetupRunning:SetupRunning=False
do until SetupRunning
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & "." & "\root\cimv2")
Set colProcesses=objWmiService.ExecQuery ("Select * From Win32_Process Where Name='msiexec.exe'")
If (colProcesses.Count>0) Then
For Each objProcess In colProcesses
If (Instr (objProcess.Commandline,"/V")=0) Then
Sleep 2000
Exit For
Else
If (colProcesses.Count=1) Then _
SetupRunning=True
End If
Next
Else
SetupRunning=True
End If
Loop
End Sub


'==================================
'Begin: Sleep
'
' This subroutine pauses script
' execution for specified amount of
' time in miliseconds.
'==================================

Private Sub Sleep (intTime)
objShell.Run "ping 1.1.1.1 -n 1 -w " & intTime,0,True
End Sub


'==================================
'End: Sleep
'==================================
Answered 03/22/2012 by: harsh_k
Purple Belt

0
+1 for Answer, this would indeed be handy, if anyone knows a solution.
Answered 03/21/2012 by: Erroneus
5th Degree Black Belt

  • Btw. a rather crude solution, could maybe monitoring if msiexec is running, though that's _FAR_ from a perfect solution.
  • msiexec.exe can be running and not actually be *doing* anything. Thats the problem.

    I just started a new job packaging/customizing MSI's and I'm finding out the hard way that windows installer is a hard mistress :(
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ