f



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

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

0
drk.kumar (3)
7/17/2006 7:38:09 PM
comp.lang.javascript 38370 articles. 0 followers. javascript4 (1315) is leader. Post Follow

1 Replies
561 Views

Similar Articles

[PageSpeed] 59

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

drk.kumar@gmail.com wrote:
> 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

0
drk
7/21/2006 5:24:57 PM
Reply: