Home All Groups Group Topic Archive Search About

what's available in WMI

Author
1 Jun 2006 1:24 PM
cj
I found this code online and it works fine but I don't understand
exactly how and am trying to.  Can someone help me?

Public Class Form1
     Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
         Dim t As Single
         Dim WMIService, Computer As Object
         WMIService =
GetObject("Winmgmts:{impersonationLevel=impersonate,(Debug,Shutdown)}")
         For Each Computer In
WMIService.InstancesOf("Win32_OperatingSystem")
             t = Computer.Win32Shutdown(8 + 4, 0)
             If t <> 0 Then
                 MsgBox("Error")
             End If
         Next
     End Sub

#1  GetObject requires a file name or a class.  As winmgmts is not a
file on my computer I assume it is a class.  How can I view it?  I
understand the impersonationlevel but not the debug, shutdown.

#2  when it says for each computer in WMIService.InstancesOf
("Win32_OperatingSystem")  what other things can I get to instead of
win32_operating sytem?  Where or how can I find out my other options?

Author
1 Jun 2006 2:14 PM
Mike Lowery
http://www.microsoft.com/technet/scriptcenter/guide/sas_wmi_overview.mspx

Show quote Hide quote
"cj" <cj@nospam.nospam> wrote in message
news:%23Qg7x6XhGHA.5088@TK2MSFTNGP02.phx.gbl...
>I found this code online and it works fine but I don't understand exactly how
>and am trying to.  Can someone help me?
>
> Public Class Form1
>     Inherits System.Windows.Forms.Form
>
> #Region " Windows Form Designer generated code "
>
> Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles Button1.Click
>         Dim t As Single
>         Dim WMIService, Computer As Object
>         WMIService =
> GetObject("Winmgmts:{impersonationLevel=impersonate,(Debug,Shutdown)}")
>         For Each Computer In WMIService.InstancesOf("Win32_OperatingSystem")
>             t = Computer.Win32Shutdown(8 + 4, 0)
>             If t <> 0 Then
>                 MsgBox("Error")
>             End If
>         Next
>     End Sub
>
> #1  GetObject requires a file name or a class.  As winmgmts is not a file on
> my computer I assume it is a class.  How can I view it?  I understand the
> impersonationlevel but not the debug, shutdown.
>
> #2  when it says for each computer in WMIService.InstancesOf
> ("Win32_OperatingSystem")  what other things can I get to instead of
> win32_operating sytem?  Where or how can I find out my other options?
Author
1 Jun 2006 2:17 PM
Mike Lowery
Actually this is the link I meant to post:
http://msdn.microsoft.com/library/en-us/dnclinic/html/scripting06112002.asp

Show quoteHide quote
"cj" <cj@nospam.nospam> wrote in message
news:%23Qg7x6XhGHA.5088@TK2MSFTNGP02.phx.gbl...
>I found this code online and it works fine but I don't understand exactly how
>and am trying to.  Can someone help me?
>
> Public Class Form1
>     Inherits System.Windows.Forms.Form
>
> #Region " Windows Form Designer generated code "
>
> Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles Button1.Click
>         Dim t As Single
>         Dim WMIService, Computer As Object
>         WMIService =
> GetObject("Winmgmts:{impersonationLevel=impersonate,(Debug,Shutdown)}")
>         For Each Computer In WMIService.InstancesOf("Win32_OperatingSystem")
>             t = Computer.Win32Shutdown(8 + 4, 0)
>             If t <> 0 Then
>                 MsgBox("Error")
>             End If
>         Next
>     End Sub
>
> #1  GetObject requires a file name or a class.  As winmgmts is not a file on
> my computer I assume it is a class.  How can I view it?  I understand the
> impersonationlevel but not the debug, shutdown.
>
> #2  when it says for each computer in WMIService.InstancesOf
> ("Win32_OperatingSystem")  what other things can I get to instead of
> win32_operating sytem?  Where or how can I find out my other options?
Author
1 Jun 2006 2:35 PM
cj
Been there done that.  I can see the examples but beyond them is dark.
What else exists?  How can I find out?  Since that is VB script it
doesn't address the {impersonationlevel=impersonate, (debug, shutdown)}.
  It doesn't even address Win32_OperatingSystem.  But it does tell me
Win32_Service, Win32_Process, Win32_LogicalMemoryConfiguration and
Win32_NTLogEvent exist.  I have to figure there are more.  How can I
find out what they are and what they do?  I ran those examples and if
they tell me I'm too dumb to understand.  I also looked at WMI Scripting
Primer: parts 2 and 3 and still no help.


Mike Lowery wrote:
Show quoteHide quote
> Actually this is the link I meant to post:
> http://msdn.microsoft.com/library/en-us/dnclinic/html/scripting06112002.asp
>
> "cj" <cj@nospam.nospam> wrote in message
> news:%23Qg7x6XhGHA.5088@TK2MSFTNGP02.phx.gbl...
>> I found this code online and it works fine but I don't understand exactly how
>> and am trying to.  Can someone help me?
>>
>> Public Class Form1
>>     Inherits System.Windows.Forms.Form
>>
>> #Region " Windows Form Designer generated code "
>>
>> Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
>> System.EventArgs) Handles Button1.Click
>>         Dim t As Single
>>         Dim WMIService, Computer As Object
>>         WMIService =
>> GetObject("Winmgmts:{impersonationLevel=impersonate,(Debug,Shutdown)}")
>>         For Each Computer In WMIService.InstancesOf("Win32_OperatingSystem")
>>             t = Computer.Win32Shutdown(8 + 4, 0)
>>             If t <> 0 Then
>>                 MsgBox("Error")
>>             End If
>>         Next
>>     End Sub
>>
>> #1  GetObject requires a file name or a class.  As winmgmts is not a file on
>> my computer I assume it is a class.  How can I view it?  I understand the
>> impersonationlevel but not the debug, shutdown.
>>
>> #2  when it says for each computer in WMIService.InstancesOf
>> ("Win32_OperatingSystem")  what other things can I get to instead of
>> win32_operating sytem?  Where or how can I find out my other options?
>
>
Author
1 Jun 2006 2:59 PM
Peter Proost
If your going to use wmi, wbemtest is a very handy
tool that comes with windows to find out what info you can get from cimv2
(all the win32 classes are listed there).
So I would also do some reading on wbemtest.

If you want I can send you and example app that uses wmi to get all sort of
pc info which I made a couple of months ago

you can mail me @ pproost at the google mail name (gmail.com)

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

Show quoteHide quote
"cj" <cj@nospam.nospam> schreef in bericht
news:#y5BZiYhGHA.3756@TK2MSFTNGP02.phx.gbl...
> Been there done that.  I can see the examples but beyond them is dark.
> What else exists?  How can I find out?  Since that is VB script it
> doesn't address the {impersonationlevel=impersonate, (debug, shutdown)}.
>   It doesn't even address Win32_OperatingSystem.  But it does tell me
> Win32_Service, Win32_Process, Win32_LogicalMemoryConfiguration and
> Win32_NTLogEvent exist.  I have to figure there are more.  How can I
> find out what they are and what they do?  I ran those examples and if
> they tell me I'm too dumb to understand.  I also looked at WMI Scripting
> Primer: parts 2 and 3 and still no help.
>
>
> Mike Lowery wrote:
> > Actually this is the link I meant to post:
> >
http://msdn.microsoft.com/library/en-us/dnclinic/html/scripting06112002.asp
Show quoteHide quote
> >
> > "cj" <cj@nospam.nospam> wrote in message
> > news:%23Qg7x6XhGHA.5088@TK2MSFTNGP02.phx.gbl...
> >> I found this code online and it works fine but I don't understand
exactly how
> >> and am trying to.  Can someone help me?
> >>
> >> Public Class Form1
> >>     Inherits System.Windows.Forms.Form
> >>
> >> #Region " Windows Form Designer generated code "
> >>
> >> Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
> >> System.EventArgs) Handles Button1.Click
> >>         Dim t As Single
> >>         Dim WMIService, Computer As Object
> >>         WMIService =
> >> GetObject("Winmgmts:{impersonationLevel=impersonate,(Debug,Shutdown)}")
> >>         For Each Computer In
WMIService.InstancesOf("Win32_OperatingSystem")
Show quoteHide quote
> >>             t = Computer.Win32Shutdown(8 + 4, 0)
> >>             If t <> 0 Then
> >>                 MsgBox("Error")
> >>             End If
> >>         Next
> >>     End Sub
> >>
> >> #1  GetObject requires a file name or a class.  As winmgmts is not a
file on
> >> my computer I assume it is a class.  How can I view it?  I understand
the
> >> impersonationlevel but not the debug, shutdown.
> >>
> >> #2  when it says for each computer in WMIService.InstancesOf
> >> ("Win32_OperatingSystem")  what other things can I get to instead of
> >> win32_operating sytem?  Where or how can I find out my other options?
> >
> >
Author
1 Jun 2006 3:46 PM
cj
Hi Peter, actually I tried wbemtest yesterday.  Way too many buttons.
Connection?  Credentials?  Locale?  Then Enum Classes or instances or
namespaces?  Classes I guess.  Superclass name?????  Whew!  Method
Invocation Options?????  I gave up to look for something that made more
sense to me.  I found Scriptomatic today on a Microsoft web site but it
seems to show only settings and not methods.

I've been looking at

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wmi_reference.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/operating_system_classes.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_operatingsystem.asp

for an hour or two now and while I find microsoft sites very confusing
I'm making headway.  I can't seem to find the organization between the
pages and the pane on the left never seems to follow along as I click
links.  But the stuff I'm looking for is in here somewhere.  I have to
bookmark anything that looks interesting or I might not be able to find
it again.


Peter Proost wrote:
Show quoteHide quote
> If your going to use wmi, wbemtest is a very handy
> tool that comes with windows to find out what info you can get from cimv2
> (all the win32 classes are listed there).
> So I would also do some reading on wbemtest.
>
> If you want I can send you and example app that uses wmi to get all sort of
> pc info which I made a couple of months ago
>
> you can mail me @ pproost at the google mail name (gmail.com)
>
> --
> Programming today is a race between software engineers striving to build
> bigger and better idiot-proof programs, and the Universe trying to produce
> bigger and better idiots. So far, the Universe is winning. (Rich Cook)
>
> "cj" <cj@nospam.nospam> schreef in bericht
> news:#y5BZiYhGHA.3756@TK2MSFTNGP02.phx.gbl...
>> Been there done that.  I can see the examples but beyond them is dark.
>> What else exists?  How can I find out?  Since that is VB script it
>> doesn't address the {impersonationlevel=impersonate, (debug, shutdown)}.
>>   It doesn't even address Win32_OperatingSystem.  But it does tell me
>> Win32_Service, Win32_Process, Win32_LogicalMemoryConfiguration and
>> Win32_NTLogEvent exist.  I have to figure there are more.  How can I
>> find out what they are and what they do?  I ran those examples and if
>> they tell me I'm too dumb to understand.  I also looked at WMI Scripting
>> Primer: parts 2 and 3 and still no help.
>>
>>
>> Mike Lowery wrote:
>>> Actually this is the link I meant to post:
>>>
> http://msdn.microsoft.com/library/en-us/dnclinic/html/scripting06112002.asp
>>> "cj" <cj@nospam.nospam> wrote in message
>>> news:%23Qg7x6XhGHA.5088@TK2MSFTNGP02.phx.gbl...
>>>> I found this code online and it works fine but I don't understand
> exactly how
>>>> and am trying to.  Can someone help me?
>>>>
>>>> Public Class Form1
>>>>     Inherits System.Windows.Forms.Form
>>>>
>>>> #Region " Windows Form Designer generated code "
>>>>
>>>> Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
>>>> System.EventArgs) Handles Button1.Click
>>>>         Dim t As Single
>>>>         Dim WMIService, Computer As Object
>>>>         WMIService =
>>>> GetObject("Winmgmts:{impersonationLevel=impersonate,(Debug,Shutdown)}")
>>>>         For Each Computer In
> WMIService.InstancesOf("Win32_OperatingSystem")
>>>>             t = Computer.Win32Shutdown(8 + 4, 0)
>>>>             If t <> 0 Then
>>>>                 MsgBox("Error")
>>>>             End If
>>>>         Next
>>>>     End Sub
>>>>
>>>> #1  GetObject requires a file name or a class.  As winmgmts is not a
> file on
>>>> my computer I assume it is a class.  How can I view it?  I understand
> the
>>>> impersonationlevel but not the debug, shutdown.
>>>>
>>>> #2  when it says for each computer in WMIService.InstancesOf
>>>> ("Win32_OperatingSystem")  what other things can I get to instead of
>>>> win32_operating sytem?  Where or how can I find out my other options?
>>>
>
>
Author
1 Jun 2006 5:35 PM
Mike Lowery
I thought those primers talked about using the wbem tool?  (not going to go back
and look)

This tool should also help:
http://www.microsoft.com/technet/scriptcenter/tools/wmimatic.mspx

Show quoteHide quote
"cj" <cj@nospam.nospam> wrote in message
news:O4D6FKZhGHA.4284@TK2MSFTNGP05.phx.gbl...
> Hi Peter, actually I tried wbemtest yesterday.  Way too many buttons.
> Connection?  Credentials?  Locale?  Then Enum Classes or instances or
> namespaces?  Classes I guess.  Superclass name?????  Whew!  Method Invocation
> Options?????  I gave up to look for something that made more sense to me.  I
> found Scriptomatic today on a Microsoft web site but it seems to show only
> settings and not methods.
>
> I've been looking at
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wmi_reference.asp
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/operating_system_classes.asp
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_operatingsystem.asp
>
> for an hour or two now and while I find microsoft sites very confusing I'm
> making headway.  I can't seem to find the organization between the pages and
> the pane on the left never seems to follow along as I click links.  But the
> stuff I'm looking for is in here somewhere.  I have to bookmark anything that
> looks interesting or I might not be able to find it again.
>
>
> Peter Proost wrote:
>> If your going to use wmi, wbemtest is a very handy
>> tool that comes with windows to find out what info you can get from cimv2
>> (all the win32 classes are listed there).
>> So I would also do some reading on wbemtest.
>>
>> If you want I can send you and example app that uses wmi to get all sort of
>> pc info which I made a couple of months ago
>>
>> you can mail me @ pproost at the google mail name (gmail.com)
>>
>> --
>> Programming today is a race between software engineers striving to build
>> bigger and better idiot-proof programs, and the Universe trying to produce
>> bigger and better idiots. So far, the Universe is winning. (Rich Cook)
>>
>> "cj" <cj@nospam.nospam> schreef in bericht
>> news:#y5BZiYhGHA.3756@TK2MSFTNGP02.phx.gbl...
>>> Been there done that.  I can see the examples but beyond them is dark.
>>> What else exists?  How can I find out?  Since that is VB script it
>>> doesn't address the {impersonationlevel=impersonate, (debug, shutdown)}.
>>>   It doesn't even address Win32_OperatingSystem.  But it does tell me
>>> Win32_Service, Win32_Process, Win32_LogicalMemoryConfiguration and
>>> Win32_NTLogEvent exist.  I have to figure there are more.  How can I
>>> find out what they are and what they do?  I ran those examples and if
>>> they tell me I'm too dumb to understand.  I also looked at WMI Scripting
>>> Primer: parts 2 and 3 and still no help.
>>>
>>>
>>> Mike Lowery wrote:
>>>> Actually this is the link I meant to post:
>>>>
>> http://msdn.microsoft.com/library/en-us/dnclinic/html/scripting06112002.asp
>>>> "cj" <cj@nospam.nospam> wrote in message
>>>> news:%23Qg7x6XhGHA.5088@TK2MSFTNGP02.phx.gbl...
>>>>> I found this code online and it works fine but I don't understand
>> exactly how
>>>>> and am trying to.  Can someone help me?
>>>>>
>>>>> Public Class Form1
>>>>>     Inherits System.Windows.Forms.Form
>>>>>
>>>>> #Region " Windows Form Designer generated code "
>>>>>
>>>>> Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
>>>>> System.EventArgs) Handles Button1.Click
>>>>>         Dim t As Single
>>>>>         Dim WMIService, Computer As Object
>>>>>         WMIService =
>>>>> GetObject("Winmgmts:{impersonationLevel=impersonate,(Debug,Shutdown)}")
>>>>>         For Each Computer In
>> WMIService.InstancesOf("Win32_OperatingSystem")
>>>>>             t = Computer.Win32Shutdown(8 + 4, 0)
>>>>>             If t <> 0 Then
>>>>>                 MsgBox("Error")
>>>>>             End If
>>>>>         Next
>>>>>     End Sub
>>>>>
>>>>> #1  GetObject requires a file name or a class.  As winmgmts is not a
>> file on
>>>>> my computer I assume it is a class.  How can I view it?  I understand
>> the
>>>>> impersonationlevel but not the debug, shutdown.
>>>>>
>>>>> #2  when it says for each computer in WMIService.InstancesOf
>>>>> ("Win32_OperatingSystem")  what other things can I get to instead of
>>>>> win32_operating sytem?  Where or how can I find out my other options?
>>>>
>>
Author
1 Jun 2006 5:48 PM
cj
If they did I didn't get it.  I know they mentioned it but I don't think
they explained it--well at least they didn't enough for me.

Yea, the scriptomatic tool is pretty good.

I think I'm ok for now.  I appreciate the help Mike and Peter.

Mike Lowery wrote:
Show quoteHide quote
> I thought those primers talked about using the wbem tool?  (not going to go back
> and look)
>
> This tool should also help:
> http://www.microsoft.com/technet/scriptcenter/tools/wmimatic.mspx
>
> "cj" <cj@nospam.nospam> wrote in message
> news:O4D6FKZhGHA.4284@TK2MSFTNGP05.phx.gbl...
>> Hi Peter, actually I tried wbemtest yesterday.  Way too many buttons.
>> Connection?  Credentials?  Locale?  Then Enum Classes or instances or
>> namespaces?  Classes I guess.  Superclass name?????  Whew!  Method Invocation
>> Options?????  I gave up to look for something that made more sense to me.  I
>> found Scriptomatic today on a Microsoft web site but it seems to show only
>> settings and not methods.
>>
>> I've been looking at
>>
>> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wmi_reference.asp
>> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/operating_system_classes.asp
>> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_operatingsystem.asp
>>
>> for an hour or two now and while I find microsoft sites very confusing I'm
>> making headway.  I can't seem to find the organization between the pages and
>> the pane on the left never seems to follow along as I click links.  But the
>> stuff I'm looking for is in here somewhere.  I have to bookmark anything that
>> looks interesting or I might not be able to find it again.
>>
>>
>> Peter Proost wrote:
>>> If your going to use wmi, wbemtest is a very handy
>>> tool that comes with windows to find out what info you can get from cimv2
>>> (all the win32 classes are listed there).
>>> So I would also do some reading on wbemtest.
>>>
>>> If you want I can send you and example app that uses wmi to get all sort of
>>> pc info which I made a couple of months ago
>>>
>>> you can mail me @ pproost at the google mail name (gmail.com)
>>>
>>> --
>>> Programming today is a race between software engineers striving to build
>>> bigger and better idiot-proof programs, and the Universe trying to produce
>>> bigger and better idiots. So far, the Universe is winning. (Rich Cook)
>>>
>>> "cj" <cj@nospam.nospam> schreef in bericht
>>> news:#y5BZiYhGHA.3756@TK2MSFTNGP02.phx.gbl...
>>>> Been there done that.  I can see the examples but beyond them is dark.
>>>> What else exists?  How can I find out?  Since that is VB script it
>>>> doesn't address the {impersonationlevel=impersonate, (debug, shutdown)}.
>>>>   It doesn't even address Win32_OperatingSystem.  But it does tell me
>>>> Win32_Service, Win32_Process, Win32_LogicalMemoryConfiguration and
>>>> Win32_NTLogEvent exist.  I have to figure there are more.  How can I
>>>> find out what they are and what they do?  I ran those examples and if
>>>> they tell me I'm too dumb to understand.  I also looked at WMI Scripting
>>>> Primer: parts 2 and 3 and still no help.
>>>>
>>>>
>>>> Mike Lowery wrote:
>>>>> Actually this is the link I meant to post:
>>>>>
>>> http://msdn.microsoft.com/library/en-us/dnclinic/html/scripting06112002.asp
>>>>> "cj" <cj@nospam.nospam> wrote in message
>>>>> news:%23Qg7x6XhGHA.5088@TK2MSFTNGP02.phx.gbl...
>>>>>> I found this code online and it works fine but I don't understand
>>> exactly how
>>>>>> and am trying to.  Can someone help me?
>>>>>>
>>>>>> Public Class Form1
>>>>>>     Inherits System.Windows.Forms.Form
>>>>>>
>>>>>> #Region " Windows Form Designer generated code "
>>>>>>
>>>>>> Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
>>>>>> System.EventArgs) Handles Button1.Click
>>>>>>         Dim t As Single
>>>>>>         Dim WMIService, Computer As Object
>>>>>>         WMIService =
>>>>>> GetObject("Winmgmts:{impersonationLevel=impersonate,(Debug,Shutdown)}")
>>>>>>         For Each Computer In
>>> WMIService.InstancesOf("Win32_OperatingSystem")
>>>>>>             t = Computer.Win32Shutdown(8 + 4, 0)
>>>>>>             If t <> 0 Then
>>>>>>                 MsgBox("Error")
>>>>>>             End If
>>>>>>         Next
>>>>>>     End Sub
>>>>>>
>>>>>> #1  GetObject requires a file name or a class.  As winmgmts is not a
>>> file on
>>>>>> my computer I assume it is a class.  How can I view it?  I understand
>>> the
>>>>>> impersonationlevel but not the debug, shutdown.
>>>>>>
>>>>>> #2  when it says for each computer in WMIService.InstancesOf
>>>>>> ("Win32_OperatingSystem")  what other things can I get to instead of
>>>>>> win32_operating sytem?  Where or how can I find out my other options?
>
Author
1 Jun 2006 5:52 PM
Cor Ligthert [MVP]
cj,

Why don't you than not accept Peters offer to sent the program he made. I
think that most of us made such a kind of program. The one of my is to old
and probably to clumsy to make the same offer as Peter.

Remember for WMI that is is just a bunch of collections holding collections
which can hold collections again. If something does not exist can be because
the hard or software is just not giving the information that is needed
because it does not exist. Let say by instance a mainboard serial number.

I hope this helps,

Cor

Show quoteHide quote
"cj" <cj@nospam.nospam> schreef in bericht
news:O4D6FKZhGHA.4284@TK2MSFTNGP05.phx.gbl...
> Hi Peter, actually I tried wbemtest yesterday.  Way too many buttons.
> Connection?  Credentials?  Locale?  Then Enum Classes or instances or
> namespaces?  Classes I guess.  Superclass name?????  Whew!  Method
> Invocation Options?????  I gave up to look for something that made more
> sense to me.  I found Scriptomatic today on a Microsoft web site but it
> seems to show only settings and not methods.
>
> I've been looking at
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wmi_reference.asp
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/operating_system_classes.asp
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_operatingsystem.asp
>
> for an hour or two now and while I find microsoft sites very confusing I'm
> making headway.  I can't seem to find the organization between the pages
> and the pane on the left never seems to follow along as I click links.
> But the stuff I'm looking for is in here somewhere.  I have to bookmark
> anything that looks interesting or I might not be able to find it again.
>
>
> Peter Proost wrote:
>> If your going to use wmi, wbemtest is a very handy
>> tool that comes with windows to find out what info you can get from cimv2
>> (all the win32 classes are listed there).
>> So I would also do some reading on wbemtest.
>>
>> If you want I can send you and example app that uses wmi to get all sort
>> of
>> pc info which I made a couple of months ago
>>
>> you can mail me @ pproost at the google mail name (gmail.com)
>>
>> --
>> Programming today is a race between software engineers striving to build
>> bigger and better idiot-proof programs, and the Universe trying to
>> produce
>> bigger and better idiots. So far, the Universe is winning. (Rich Cook)
>>
>> "cj" <cj@nospam.nospam> schreef in bericht
>> news:#y5BZiYhGHA.3756@TK2MSFTNGP02.phx.gbl...
>>> Been there done that.  I can see the examples but beyond them is dark.
>>> What else exists?  How can I find out?  Since that is VB script it
>>> doesn't address the {impersonationlevel=impersonate, (debug, shutdown)}.
>>>   It doesn't even address Win32_OperatingSystem.  But it does tell me
>>> Win32_Service, Win32_Process, Win32_LogicalMemoryConfiguration and
>>> Win32_NTLogEvent exist.  I have to figure there are more.  How can I
>>> find out what they are and what they do?  I ran those examples and if
>>> they tell me I'm too dumb to understand.  I also looked at WMI Scripting
>>> Primer: parts 2 and 3 and still no help.
>>>
>>>
>>> Mike Lowery wrote:
>>>> Actually this is the link I meant to post:
>>>>
>> http://msdn.microsoft.com/library/en-us/dnclinic/html/scripting06112002.asp
>>>> "cj" <cj@nospam.nospam> wrote in message
>>>> news:%23Qg7x6XhGHA.5088@TK2MSFTNGP02.phx.gbl...
>>>>> I found this code online and it works fine but I don't understand
>> exactly how
>>>>> and am trying to.  Can someone help me?
>>>>>
>>>>> Public Class Form1
>>>>>     Inherits System.Windows.Forms.Form
>>>>>
>>>>> #Region " Windows Form Designer generated code "
>>>>>
>>>>> Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
>>>>> System.EventArgs) Handles Button1.Click
>>>>>         Dim t As Single
>>>>>         Dim WMIService, Computer As Object
>>>>>         WMIService =
>>>>> GetObject("Winmgmts:{impersonationLevel=impersonate,(Debug,Shutdown)}")
>>>>>         For Each Computer In
>> WMIService.InstancesOf("Win32_OperatingSystem")
>>>>>             t = Computer.Win32Shutdown(8 + 4, 0)
>>>>>             If t <> 0 Then
>>>>>                 MsgBox("Error")
>>>>>             End If
>>>>>         Next
>>>>>     End Sub
>>>>>
>>>>> #1  GetObject requires a file name or a class.  As winmgmts is not a
>> file on
>>>>> my computer I assume it is a class.  How can I view it?  I understand
>> the
>>>>> impersonationlevel but not the debug, shutdown.
>>>>>
>>>>> #2  when it says for each computer in WMIService.InstancesOf
>>>>> ("Win32_OperatingSystem")  what other things can I get to instead of
>>>>> win32_operating sytem?  Where or how can I find out my other options?
>>>>
>>
Author
1 Jun 2006 6:09 PM
cj
I appreciate Peter's offer but I think I'm ok now.


Cor Ligthert [MVP] wrote:
Show quoteHide quote
> cj,
>
> Why don't you than not accept Peters offer to sent the program he made. I
> think that most of us made such a kind of program. The one of my is to old
> and probably to clumsy to make the same offer as Peter.
>
> Remember for WMI that is is just a bunch of collections holding collections
> which can hold collections again. If something does not exist can be because
> the hard or software is just not giving the information that is needed
> because it does not exist. Let say by instance a mainboard serial number.
>
> I hope this helps,
>
> Cor
>
> "cj" <cj@nospam.nospam> schreef in bericht
> news:O4D6FKZhGHA.4284@TK2MSFTNGP05.phx.gbl...
>> Hi Peter, actually I tried wbemtest yesterday.  Way too many buttons.
>> Connection?  Credentials?  Locale?  Then Enum Classes or instances or
>> namespaces?  Classes I guess.  Superclass name?????  Whew!  Method
>> Invocation Options?????  I gave up to look for something that made more
>> sense to me.  I found Scriptomatic today on a Microsoft web site but it
>> seems to show only settings and not methods.
>>
>> I've been looking at
>>
>> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wmi_reference.asp
>> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/operating_system_classes.asp
>> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_operatingsystem.asp
>>
>> for an hour or two now and while I find microsoft sites very confusing I'm
>> making headway.  I can't seem to find the organization between the pages
>> and the pane on the left never seems to follow along as I click links.
>> But the stuff I'm looking for is in here somewhere.  I have to bookmark
>> anything that looks interesting or I might not be able to find it again.
>>
>>
>> Peter Proost wrote:
>>> If your going to use wmi, wbemtest is a very handy
>>> tool that comes with windows to find out what info you can get from cimv2
>>> (all the win32 classes are listed there).
>>> So I would also do some reading on wbemtest.
>>>
>>> If you want I can send you and example app that uses wmi to get all sort
>>> of
>>> pc info which I made a couple of months ago
>>>
>>> you can mail me @ pproost at the google mail name (gmail.com)
>>>
>>> --
>>> Programming today is a race between software engineers striving to build
>>> bigger and better idiot-proof programs, and the Universe trying to
>>> produce
>>> bigger and better idiots. So far, the Universe is winning. (Rich Cook)
>>>
>>> "cj" <cj@nospam.nospam> schreef in bericht
>>> news:#y5BZiYhGHA.3756@TK2MSFTNGP02.phx.gbl...
>>>> Been there done that.  I can see the examples but beyond them is dark.
>>>> What else exists?  How can I find out?  Since that is VB script it
>>>> doesn't address the {impersonationlevel=impersonate, (debug, shutdown)}.
>>>>   It doesn't even address Win32_OperatingSystem.  But it does tell me
>>>> Win32_Service, Win32_Process, Win32_LogicalMemoryConfiguration and
>>>> Win32_NTLogEvent exist.  I have to figure there are more.  How can I
>>>> find out what they are and what they do?  I ran those examples and if
>>>> they tell me I'm too dumb to understand.  I also looked at WMI Scripting
>>>> Primer: parts 2 and 3 and still no help.
>>>>
>>>>
>>>> Mike Lowery wrote:
>>>>> Actually this is the link I meant to post:
>>>>>
>>> http://msdn.microsoft.com/library/en-us/dnclinic/html/scripting06112002.asp
>>>>> "cj" <cj@nospam.nospam> wrote in message
>>>>> news:%23Qg7x6XhGHA.5088@TK2MSFTNGP02.phx.gbl...
>>>>>> I found this code online and it works fine but I don't understand
>>> exactly how
>>>>>> and am trying to.  Can someone help me?
>>>>>>
>>>>>> Public Class Form1
>>>>>>     Inherits System.Windows.Forms.Form
>>>>>>
>>>>>> #Region " Windows Form Designer generated code "
>>>>>>
>>>>>> Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
>>>>>> System.EventArgs) Handles Button1.Click
>>>>>>         Dim t As Single
>>>>>>         Dim WMIService, Computer As Object
>>>>>>         WMIService =
>>>>>> GetObject("Winmgmts:{impersonationLevel=impersonate,(Debug,Shutdown)}")
>>>>>>         For Each Computer In
>>> WMIService.InstancesOf("Win32_OperatingSystem")
>>>>>>             t = Computer.Win32Shutdown(8 + 4, 0)
>>>>>>             If t <> 0 Then
>>>>>>                 MsgBox("Error")
>>>>>>             End If
>>>>>>         Next
>>>>>>     End Sub
>>>>>>
>>>>>> #1  GetObject requires a file name or a class.  As winmgmts is not a
>>> file on
>>>>>> my computer I assume it is a class.  How can I view it?  I understand
>>> the
>>>>>> impersonationlevel but not the debug, shutdown.
>>>>>>
>>>>>> #2  when it says for each computer in WMIService.InstancesOf
>>>>>> ("Win32_OperatingSystem")  what other things can I get to instead of
>>>>>> win32_operating sytem?  Where or how can I find out my other options?
>