Strange WMI behaviour

Posted: 08-11-2005, 05:58 PM
I'm writing some code in VB.Net that is trying to check that a specific
application has been installed. My code is thus:

Dim myObjectSearcher As System.Management.ManagementObjectSearcher
Dim myCollection As System.Management.ManagementObjectCollection
Dim myObject As System.Management.ManagementObject
Dim bolFound As Boolean = False

myObjectSearcher = New
System.Management.ManagementObjectSearcher("Select * From Win32_Product
Where Caption = ""Magic Widget App""")
myCollection = myObjectSearcher.Get()
For Each myObject In myCollection
' Because we've filtered the collection fetching, ANY entry must
be a match
bolFound = True
Exit For

What I'm finding is that, occasionally (*), the code just seems to stop at
the For Each loop. It doesn't crash - it just seems to stop and not go any

(*) It seems to happen more often when I'm logged on at the computer using
cached credentials.

I'm running the code on XP SP 2 with a normal user account.

Is there anything wrong with my code? Has anyone else come across this?


Strange WMI behaviour

Responses to "Strange WMI behaviour"

LinkBack Thread Tools Display Modes

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ReadyBoost - Same USB Drive, Different Behaviour in 32 & 64 bit Vi Bob H Windows Vista Performance & Maintenance 4 10-27-2006 07:55 AM
cannot delete directory. Strange behaviour Carlo Windows Vista File Management 0 09-19-2006 04:29 PM
Bad XP Hard Drive Behaviour. Danny L. Painter Windows XP Hardware 0 07-18-2003 08:05 PM
Strange behaviour regarding profile/users Douglas Windows XP New Users 1 07-03-2003 07:56 PM
Explorer strange behaviour Fried Kampes Windows XP New Users 0 07-01-2003 05:13 AM