By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,550 Members | 908 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,550 IT Pros & Developers. It's quick & easy.

WMI script to get Win32_Product

P: n/a
I have this script

Dim query As New ManagementObjectSearcher("Select * from Select * from
Win32_Product")

Debug.Write(query.Get().Count)

For Each mo As ManagementObject In query.Get

Me.ListBox1.Items.Add(mo("Name"))

Next

but it returns nothing, however other WMI scripts work fine...This should
list all the software instaled on a system. Why does it return nothing?
Apr 3 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Hi,

I never have had any problems with using Win32_Product. I would suspect
it has something to do with your query.

Select * from Select * from Win32_Product

Should be

Select * from Win32_Product

Ken
-------------------------
"Brian Henry" wrote:
I have this script

Dim query As New ManagementObjectSearcher("Select * from Select * from
Win32_Product")

Debug.Write(query.Get().Count)

For Each mo As ManagementObject In query.Get

Me.ListBox1.Items.Add(mo("Name"))

Next

but it returns nothing, however other WMI scripts work fine...This should
list all the software instaled on a system. Why does it return nothing?

Apr 3 '06 #2

P: n/a
whoops i retyped it wrong..

has nothing to do with the query, In code it is only "select * from
Win32_Product", what happens is when i step through it line by line, when it
hits this line

For Each mo As ManagementObject In query.Get

the execution of the sub just stops and it jumps out of the sub... execute
query.get on its own line and the same thing happens, no code is executed
after that statement in the sub... (this is on win xp pro 64-bit edition, in
..NET 2.0) so when i step to that line .. press the button for stepping on
the line to step again it just jumps from that line and out of the sub... im
just confused... when i do any other WMI query they execute perfectly fine..
Apr 3 '06 #3

P: n/a
fixed it turned out WMI isnt installed on 64bit windows xp by default
*rolles eyes* because its based on windows server not xp..

"Brian Henry" <no****@nospam.com> wrote in message
news:OD**************@TK2MSFTNGP12.phx.gbl...
whoops i retyped it wrong..

has nothing to do with the query, In code it is only "select * from
Win32_Product", what happens is when i step through it line by line, when
it hits this line

For Each mo As ManagementObject In query.Get

the execution of the sub just stops and it jumps out of the sub... execute
query.get on its own line and the same thing happens, no code is executed
after that statement in the sub... (this is on win xp pro 64-bit edition,
in .NET 2.0) so when i step to that line .. press the button for stepping
on the line to step again it just jumps from that line and out of the
sub... im just confused... when i do any other WMI query they execute
perfectly fine..

Apr 3 '06 #4

P: n/a
Brian,

The WMI is installed with xp pro x64. I really dont understand
why it is not working on your system because the code ran fine on my xp x64
pro system.

Ken
---------------
"Brian Henry" <no****@nospam.com> wrote in message
news:eB**************@TK2MSFTNGP11.phx.gbl...
fixed it turned out WMI isnt installed on 64bit windows xp by default
*rolles eyes* because its based on windows server not xp..

"Brian Henry" <no****@nospam.com> wrote in message
news:OD**************@TK2MSFTNGP12.phx.gbl...
whoops i retyped it wrong..

has nothing to do with the query, In code it is only "select * from
Win32_Product", what happens is when i step through it line by line, when
it hits this line

For Each mo As ManagementObject In query.Get

the execution of the sub just stops and it jumps out of the sub...
execute query.get on its own line and the same thing happens, no code is
executed after that statement in the sub... (this is on win xp pro 64-bit
edition, in .NET 2.0) so when i step to that line .. press the button for
stepping on the line to step again it just jumps from that line and out
of the sub... im just confused... when i do any other WMI query they
execute perfectly fine..


Apr 3 '06 #5

P: n/a
strange, on mine when I added WMI under the list of managment objects I
could install in add programs for windows, it started to work, removed it,
it stoped working...

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:ug**************@TK2MSFTNGP11.phx.gbl...
Brian,

The WMI is installed with xp pro x64. I really dont understand
why it is not working on your system because the code ran fine on my xp
x64 pro system.

Ken
---------------
"Brian Henry" <no****@nospam.com> wrote in message
news:eB**************@TK2MSFTNGP11.phx.gbl...
fixed it turned out WMI isnt installed on 64bit windows xp by default
*rolles eyes* because its based on windows server not xp..

"Brian Henry" <no****@nospam.com> wrote in message
news:OD**************@TK2MSFTNGP12.phx.gbl...
whoops i retyped it wrong..

has nothing to do with the query, In code it is only "select * from
Win32_Product", what happens is when i step through it line by line,
when it hits this line

For Each mo As ManagementObject In query.Get

the execution of the sub just stops and it jumps out of the sub...
execute query.get on its own line and the same thing happens, no code is
executed after that statement in the sub... (this is on win xp pro
64-bit edition, in .NET 2.0) so when i step to that line .. press the
button for stepping on the line to step again it just jumps from that
line and out of the sub... im just confused... when i do any other WMI
query they execute perfectly fine..



Apr 3 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.