Richard
Tue Apr 27 14:49:31 CDT 2004
Hi,
I found documentation that says the Win32_ComputerSystem class requires NT
or above, and NT clients (and servers) require NT 4.0 SP4 or later. Does
this account for your error? If so, the error trapping I gave earlier should
help, but the information is not available on the older OS's.
--
Richard
Microsoft MVP Scripting and ADSI
HilltopLab web site -
http://www.rlmueller.net
--
"Richard Mueller [MVP]" <rlmueller-NOSPAM@ameritech.NOSPAM.net> wrote in
message news:%23RY7N$ILEHA.1612@TK2MSFTNGP12.phx.gbl...
> Hi,
>
> That error message means that WMI is installed on the machine, but the
> specific WMI class is not supported. In this case, the
Win32_ComputerSystem
> class. Not all classes are supported on all clients, although I don't
recall
> seeing this one fail. What is the client OS?
>
> If you want to trap this error, you could use:
>
> ' Specify NetBIOS name of the computer.
> strComputer = "image"
>
> ' Trap the error if WMI is not installed, or if the computer
> ' is off line.
> On Error Resume Next
> Set objWMIService = GetObject("winmgmts:" _
> & "{impersonationLevel=impersonate}!\\" _
> & strComputer & "\root\cimv2")
> If Err.Number <> 0 Then
> On Error GoTo 0
> Wscript.Echo strComputer & " does not have WMI installed"
> Else
> ' Trap the error if the WMI class is not supported.
> Set colComputers = objWMIService.ExecQuery _
> ("SELECT * FROM Win32_ComputerSystem")
> If Err.Number <> 0 Then
> On Error GoTo 0
> Wscript.Echo strComputer _
> & " does not support the Win32_ComputerSystem class"
> Else
> On Error GoTo 0
> For Each objComputer In colComputers
> intRole = objComputer.DomainRole
> Select Case intRole
> Case 0
> strRole = " is a standalone workstation"
> Case 1
> strRole = " is a member workstation"
> Case 2
> strRole = " is a standalone server"
> Case 3
> strRole = " is a member server"
> Case 4
> strRole = " is a backup domain controller"
> Case 5
> strRole = " is a primary domain controller"
> End Select
> Wscript.Echo strComputer & strRole
> Next
> End If
> End If
>
> --
> Richard
> Microsoft MVP Scripting and ADSI
> HilltopLab web site -
http://www.rlmueller.net
> --
>
> --
> Richard
> Microsoft MVP Scripting and ADSI
> HilltopLab web site -
http://www.rlmueller.net
> --
> "Keith" <anonymous@discussions.microsoft.com> wrote in message
> news:47F22EC0-C563-4464-85F1-FD2249C62B4B@microsoft.com...
> > When I do that I get an error: "Library not registed." An it points to
> the line:
> > Set colComputers = objWMIService.ExecQuery _
> > ("SELECT * FROM Win32_ComputerSystem")
>
>
>