/build/static/layout/Breadcrumb_cap_w.png

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

Hi all,

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

Thanks!

Lewis

0 Comments   [ + ] Show comments

Answers (3)

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 '==================================
Posted by: RaginX 12 years ago
Orange Belt
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?

Comments:
  • Good find @RaginX
    I indeed does make the above specified entry, giving the location of MSI from which it is being executed. - akki 12 years ago
Posted by: harsh_k 12 years ago
Purple Belt
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
'==================================
Posted by: Erroneus 12 years ago
5th Degree Black Belt
0
+1 for Answer, this would indeed be handy, if anyone knows a solution.

Comments:
  • Btw. a rather crude solution, could maybe monitoring if msiexec is running, though that's _FAR_ from a perfect solution. - Erroneus 12 years ago
  • 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 :( - lewcianci 12 years ago
 
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