|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
WMI script to get Win32_ProductI 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? 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 ------------------------- Show quoteHide quote "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? > > > 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.. fixed it turned out WMI isnt installed on 64bit windows xp by default
*rolles eyes* because its based on windows server not xp.. Show quoteHide quote "Brian Henry" <nospam@nospam.com> wrote in message news:ODIXaHzVGHA.5172@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.. > 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 --------------- Show quoteHide quote "Brian Henry" <nospam@nospam.com> wrote in message news:eBFi8H1VGHA.1764@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" <nospam@nospam.com> wrote in message > news:ODIXaHzVGHA.5172@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.. >> > > 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... Show quoteHide quote "Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message news:ug982D3VGHA.2952@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" <nospam@nospam.com> wrote in message > news:eBFi8H1VGHA.1764@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" <nospam@nospam.com> wrote in message >> news:ODIXaHzVGHA.5172@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.. >>> >> >> > >
Trying to "display" control characters in a text box
Unique Machine Identifier Have you upgraded to VS 2005? Getting the selected item from a listview Where to do the Loading tasks for application ? Foreign Language Names Joining files error line number closing a form for mobile application Typed Dataset and Numeric Only Fields in VB.Net 2005 ? |
|||||||||||||||||||||||