May 182011
 

Hi all,

Thought I’d do a post on some JS as I haven’t done much in a while.
Today, I will go over some windows script host objects that may come in useful.
First up – wsh.network

Firstly we need to create the ActiveX Object in Javascript like so :


var wsh = new ActiveXObject(wscript.network)

Once this ActiveX Object is created, we can now use it to grab data from the computer using the properties of wsh.


var strCompName = wsh.computername;

That code snippet will store the NetBios computer name into strCompName, easy as pie.

If you have any questions or comments, please feel free to leave a comment below.

Reference
MSDN WSH.Neworking

Share