"Automation server can't create Objects" error while accessing the WMI scripts from Linux box

D

drk.kumar

I have an implementation issue with WMI scripts to check the user
machine processor. The implementation is working fine in the local
machine (Windows XP operating system). It is throwing script error in
the DEV environment (Application deployed in the linux box).

Following is the javascript code to detect the processor,

function detectProcessor()
{
var locator = new ActiveXObject
("WbemScripting.SWbemLocator");
var service = locator.ConnectServer(".");
var properties = service.ExecQuery(" SELECT * FROM
WIN32_Processor");
var e = new Enumerator (properties);
for (;!e.atEnd();e.moveNext ())
{
var processor = e.item ();
alert("Processor : " +processor.Name);
}
return processor.Name;
}


When the application is deployed in the linux environment, and the
application invokes the detectProcessor() method, the browser throws an
error message as "Error : Automation server can't create object". (It
fails at the time of ActiveX creation) The above implementation is not
able to create the activeX component in the client machine.

I tried an alternate way as follows:
<object id='locator'
classid='clsid:76A64158-CB41-11D1-8B02-00600806D9B6'>
</object>

The above class id is for the built-in activeX
("WbemScripting.SWbemLocator") in the client windows OS Machine
function detectProcessor(){
var service = locator.ConnectServer();
var properties = service.ExecQuery(" SELECT * FROM
WIN32_Processor");
var e = new Enumerator (properties);
for (;!e.atEnd();e.moveNext ())
{
var processor = e.item ();
alert("Processor : " +processor.Name);
}
return processor.Name;
}
This time the browser throws an exception that "the object doesn't have
the method or support the functionality". This time, the activeX
reference is pointed by the system. It failed to create the service. I
copied the view source code of the browser and saved into a
TestWin.html file. When I opened the html file in the local system, the
function executed without any problems.

Please reply if you know any resolution on this.
Thanks in advance
Krishnakumar
 
D

drk.kumar

I got a fix on that. This was not related with linux - windows problem.
It was security related problem in the IE. The activeX's were not able
to create their instances in the client side because of the IE security
settings. By default, IE doesnt allow to create the active-X
components(eg WBEMLocator) written in winscripts.

we have to make the url as "Trusted". In the menu, Tools -->
InternetOptions --> Security --> TrustedSites. Click "Sites" and enter
the url in the text box , click add. Now the winscript will executed in
the client machine without any error.

Thanks
Krishnakumar
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top