Victor
2006-11-13 01:58:56 UTC
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>
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>