Home > Archive > Visual Basic Syntax > April 2005 > WMI & VB6
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Andrew 2005-04-07, 8:59 pm |
| I have been wading through the mountains of documentation for WMI scripting,
and trying to figure out how to implement the "JoinDomainOrWorkgroup" method
of Win32_ComputerSystem in a regular VB6 application.
There are two problems that I am having.
First, my application is strongly typed and uses early binding, so the
documentation provided in the scripting reference is not viable for me.
(Though I found some of the object types using TypeName.)
Second, I cannot figure out the proper syntax for the method call. I am so
frustrated by the documentation! All I really need is an example of some
working code that calls a WMI method from VB6.
I would really appreciate if someone could illuminate the cloudy path of WMI
for me.
| |
| Ken Halter 2005-04-07, 8:59 pm |
| "Andrew" <Andrew@discussions.microsoft.com> wrote in message
news:EB634B01-6B3B-47B3-9E40-0AECF57E7F26@microsoft.com...
>I have been wading through the mountains of documentation for WMI
>scripting,
> and trying to figure out how to implement the "JoinDomainOrWorkgroup"
> method
> of Win32_ComputerSystem in a regular VB6 application.
I'm not sure about that specific call but try downloading a few samples
from.....
ADSI/WMI
http://www.mvps.org/st-software/ADSI_WMI.htm
Poke around his entire site here...
http://www.mvps.org/st-software/
--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
Sign up now to help keep VB support alive - http://classicvb.org/petition
Please keep all discussions in the groups..
| |
| Andrew 2005-04-07, 8:59 pm |
| Ken,
Thanks for the quick response.
I reviewed the demo code from that site, and unfortunately, the only thing I
could find were a series of query methods that return a set that can be
enumerated. Unfortunately, those are easy to implement, and the documentation
is fairly complete.
The real problem I'm encountering has to do with executing methods that act
upon the specific object, not methods that return result sets.
Consider the following:
Private Sub Form_Load()
Dim objsrv As WbemScripting.SWbemServicesEx
Dim obj As WbemScripting.SWbemObject
Set objsrv = GetObject("winmgmts:\\.\root\CIMV2")
Set obj = GetObject("winmgmts:\\.\root\CIMV2:win32_computersystem")
obj = objsrv.ExecMethod("Win32_ComputerSystem", "JoinDomainOrWorkgroup")
End Sub
ExecMethod requires additional parameters that I simply cannot figure out
based on the documentation. I _know_ what the parameters are (such as the
domain or workgroup to join, the user account and password), but have no idea
how to pass them as a single "inparam as Object" type. I hope this makes the
confusion I'm having a little clearer.
For reference, here's the inadequate documentation from Microsoft:
http://msdn.microsoft.com/library/d...putersystem.asp
"Ken Halter" wrote:
> "Andrew" <Andrew@discussions.microsoft.com> wrote in message
> news:EB634B01-6B3B-47B3-9E40-0AECF57E7F26@microsoft.com...
>
> I'm not sure about that specific call but try downloading a few samples
> from.....
>
> ADSI/WMI
> http://www.mvps.org/st-software/ADSI_WMI.htm
>
> Poke around his entire site here...
> http://www.mvps.org/st-software/
>
> --
> Ken Halter - MS-MVP-VB - http://www.vbsight.com
> Sign up now to help keep VB support alive - http://classicvb.org/petition
> Please keep all discussions in the groups..
>
>
>
| |
| Tony Proctor 2005-04-08, 9:00 am |
| I agree the WMI documentation is less than useful Andrew...tons of marketing
stuff trying to sell the idea to the rest of the world, and very few samples
or quick-reference summaries for actually using it.
There are newsgroups specifically for wmi (& adsi). Have you tried something
like: microsoft.public.win32.programmer.wmi?
Tony Proctor
"Andrew" <Andrew@discussions.microsoft.com> wrote in message
news:EB634B01-6B3B-47B3-9E40-0AECF57E7F26@microsoft.com...
> I have been wading through the mountains of documentation for WMI
scripting,
> and trying to figure out how to implement the "JoinDomainOrWorkgroup"
method
> of Win32_ComputerSystem in a regular VB6 application.
> There are two problems that I am having.
> First, my application is strongly typed and uses early binding, so the
> documentation provided in the scripting reference is not viable for me.
> (Though I found some of the object types using TypeName.)
> Second, I cannot figure out the proper syntax for the method call. I am so
> frustrated by the documentation! All I really need is an example of some
> working code that calls a WMI method from VB6.
> I would really appreciate if someone could illuminate the cloudy path of
WMI
> for me.
| |
| Andrew 2005-04-08, 4:02 pm |
| Thanks Tony.
I'll drop a note over there and see what happens.
-Andrew
"Tony Proctor" wrote:
> I agree the WMI documentation is less than useful Andrew...tons of marketing
> stuff trying to sell the idea to the rest of the world, and very few samples
> or quick-reference summaries for actually using it.
>
> There are newsgroups specifically for wmi (& adsi). Have you tried something
> like: microsoft.public.win32.programmer.wmi?
>
> Tony Proctor
>
> "Andrew" <Andrew@discussions.microsoft.com> wrote in message
> news:EB634B01-6B3B-47B3-9E40-0AECF57E7F26@microsoft.com...
> scripting,
> method
> WMI
>
>
>
| |
| Paul Clement 2005-04-08, 8:59 pm |
| On Thu, 7 Apr 2005 14:29:08 -0700, Andrew <Andrew@discussions.microsoft.com> wrote:
¤ I have been wading through the mountains of documentation for WMI scripting,
¤ and trying to figure out how to implement the "JoinDomainOrWorkgroup" method
¤ of Win32_ComputerSystem in a regular VB6 application.
¤ There are two problems that I am having.
¤ First, my application is strongly typed and uses early binding, so the
¤ documentation provided in the scripting reference is not viable for me.
¤ (Though I found some of the object types using TypeName.)
¤ Second, I cannot figure out the proper syntax for the method call. I am so
¤ frustrated by the documentation! All I really need is an example of some
¤ working code that calls a WMI method from VB6.
¤ I would really appreciate if someone could illuminate the cloudy path of WMI
¤ for me.
You may want to check out some of the books available:
http://www.bookpool.com/ss?qs=wmi
Paul
~~~~
Microsoft MVP (Visual Basic)
|
|
|
|
|