win-pvdrivers

view waitnopendinginstallevents/waitfordevices.vbs @ 731:3b46c7474a82

Fix installer so that it definitely waits until all drivers are installed properly
author James Harper <james.harper@bendigoit.com.au>
date Sat Jan 02 10:22:04 2010 +1100 (2010-01-02)
parents
children 036172f7e1b2
line source
1 Sub DoWaitForDevices()
2 strComputer = "."
3 Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
5 ' WScript.Echo "Waiting until at least one XEN\ device exists"
7 Set colMonitoredEvents = objWMIService.ExecNotificationQuery _
8 ("SELECT * FROM __InstanceOperationEvent WITHIN 5 WHERE " _
9 & "Targetinstance ISA 'Win32_PnPEntity'")
11 Set colItems = objWMIService.ExecQuery _
12 ("Select * from Win32_PnPEntity WHERE DeviceID LIKE 'XEN\\%'")
14 XenExistsFlag = False
15 For Each objItem in colItems
16 ' WScript.Echo objItem.getObjectText_
17 ' WScript.Echo "Devices Exist"
18 XenExistsFlag = True
19 Exit For
20 Next
22 Do While Not XenExistsFlag
23 Set objEventObject = colMonitoredEvents.NextEvent()
24 Set objItem = objEventObject.Targetinstance
25 ' WScript.Echo objItem.DeviceID
26 If LCase(Left(objItem.DeviceID, 4)) = "xen\" Then
27 ' WScript.Echo "New Xen Device Created"
28 XenExistsFlag = True
29 End If
30 Loop
32 ' WScript.Echo "The End"
33 End Sub