Discussion:
WMI Knowlegebase Error
(too old to reply)
Victor
2006-11-13 01:58:56 UTC
Permalink
From this page:
http://msdn2.microsoft.com/en-gb/library/ms811556.aspx

I am testing the very last program example (reproduced below). I copied/paste the script
into an HTML page, and when I click the page I keep getting the error "Object doesn't
support this property or method: "Locator.ConnectServer'".

I'm using the exact page, what is the problem???

Thank so much,

Vic

==== included code =====

<HTML>
<HEAD>
<TITLE>WBEM VBScript Example</TITLE>

<SCRIPT FOR="mysink" EVENT="OnCompleted(hResult, ErrorObject, Context)"
LANGUAGE="VBScript">
alert("Completed")
</SCRIPT>

<SCRIPT FOR="mysink" EVENT="OnObjectReady(Winmgmt, Context)"
LANGUAGE="VBScript">
document.all.info.innerText = Winmgmt.DisplayName
</SCRIPT>

<SCRIPT LANGUAGE="VBScript">
<!--

Sub Document_OnClick
const impersonate = 3
Set Service = Locator.ConnectServer()
Service.Security_.ImpersonationLevel = impersonate
Service.GetAsync mysink,"Win32_Service.Name=""Winmgmt"""
end sub
-->
</SCRIPT>
</HEAD>
<BODY>
The name of the service is
<SPAN ID="info">
unknown
</SPAN>.
<OBJECT ID="Locator" CLASSID="CLSID:76A64158-CB41-11D1-8B02-
00600806D9B6"></OBJECT>
<OBJECT ID="mysink" CLASSID="CLSID:75718C9A-F029-11d1-A1AC-
00C04FB6C223"></OBJECT>
</BODY>
</HTML>
Jonathan Liu [MSFT]
2006-12-08 21:42:36 UTC
Permalink
This is a problem with the way the file is typed into the webpage.

What you need to do is remove the carrage return from both these lines.
That is ensure that <OBJECT ID... is on one line.


<OBJECT ID="Locator" CLASSID="CLSID:76A64158-CB41-11D1-8B02-
00600806D9B6"></OBJECT>

<OBJECT ID="mysink" CLASSID="CLSID:75718C9A-F029-11d1-A1AC-
00C04FB6C223"></OBJECT>
</BODY>
</HTML>

Thanks,
Jonathan
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
--
Post by Victor
http://msdn2.microsoft.com/en-gb/library/ms811556.aspx
I am testing the very last program example (reproduced below). I copied/paste the script
into an HTML page, and when I click the page I keep getting the error "Object doesn't
support this property or method: "Locator.ConnectServer'".
I'm using the exact page, what is the problem???
Thank so much,
Vic
==== included code =====
<HTML>
<HEAD>
<TITLE>WBEM VBScript Example</TITLE>
<SCRIPT FOR="mysink" EVENT="OnCompleted(hResult, ErrorObject, Context)"
LANGUAGE="VBScript">
alert("Completed")
</SCRIPT>
<SCRIPT FOR="mysink" EVENT="OnObjectReady(Winmgmt, Context)"
LANGUAGE="VBScript">
document.all.info.innerText = Winmgmt.DisplayName
</SCRIPT>
<SCRIPT LANGUAGE="VBScript">
<!--
Sub Document_OnClick
const impersonate = 3
Set Service = Locator.ConnectServer()
Service.Security_.ImpersonationLevel = impersonate
Service.GetAsync mysink,"Win32_Service.Name=""Winmgmt"""
end sub
-->
</SCRIPT>
</HEAD>
<BODY>
The name of the service is
<SPAN ID="info">
unknown
</SPAN>.
<OBJECT ID="Locator" CLASSID="CLSID:76A64158-CB41-11D1-8B02-
00600806D9B6"></OBJECT>
<OBJECT ID="mysink" CLASSID="CLSID:75718C9A-F029-11d1-A1AC-
00C04FB6C223"></OBJECT>
</BODY>
</HTML>
Loading...