locked
How to discover Hosts objects at runtime? RRS feed

  • Question

  • Hi every body.

    I am a novice in JavaScript. I understand that the execution environment gives you specific objects that enables you to interact with the underlying operating system. Those objects are called Host Objects. Is there a way to dynamically discover those Host Objects?

    Thursday, January 17, 2013 11:00 AM

All replies

  • If you mean things like the file system or the like, you may be blocked from access if you are running in a browser.

    If not, you can do things like:

    fso = new ActiveXObject('Scripting.FileSystemObject');

    to access the file system and maniipulate files.

    For more advanced things, you will need something like:

    var objWMIService = GetObject("winmgmts:\\\\.\\root\\cimv2");

    var aList = objWMIService.ExecQuery("SELECT * FROM Win32_Service WHERE Name = 'MyService'");

    using WMI in Windows to access things like the list of services or processes running on the machine.

    Does that help?


    Frank Perry, MSEE

    Friday, March 15, 2013 8:00 PM