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

Discussion in 'Javascript' started by drk.kumar@gmail.com, Jul 17, 2006.

  1. Guest

    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
     
    , Jul 17, 2006
    #1
    1. Advertising

  2. Guest

    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

    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
     
    , Jul 21, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. DartmanX
    Replies:
    1
    Views:
    2,068
    Roedy Green
    Apr 7, 2006
  2. Gnarlodious
    Replies:
    4
    Views:
    17,640
    elizas
    May 5, 2010
  3. botp

    wmi client gem for linux

    botp, Oct 20, 2010, in forum: Ruby
    Replies:
    0
    Views:
    159
  4. John Ramsden

    Accessing Windows WMI Info from Unix

    John Ramsden, May 11, 2004, in forum: Perl Misc
    Replies:
    0
    Views:
    135
    John Ramsden
    May 11, 2004
  5. Martin

    accessing WMI object's attributes

    Martin, Mar 11, 2005, in forum: Perl Misc
    Replies:
    1
    Views:
    152
    Thomas Kratz
    Mar 11, 2005
Loading...

Share This Page