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
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 '==================================
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 '==================================
Please log in to answer
Posted by:
RaginX
12 years ago
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?
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
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
'==================================
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
+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