How can you get the terminal service client machine name from javascript?

Is it possible to get the computer name or IP address or MAC address (mainly client network information) from javascript using Internet Explorer?

I found the following code that seems to do the following:

function Button1_onclick() { var locator = new ActiveXObject("WbemScripting.SWbemLocator"); var service = locator.ConnectServer("."); var properties = service.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration"); var e = new Enumerator (properties); document.write("<table border=1>"); dispHeading(); for (;!e.atEnd();e.moveNext ()) { var p = e.item (); document.write("<tr>"); document.write("<td>" + p.Caption + "</td>"); document.write("<td>" + p.IPFilterSecurityEnabled + "</td>"); document.write("<td>" + p.IPPortSecurityEnabled + "</td>"); document.write("<td>" + p.IPXAddress + "</td>"); document.write("<td>" + p.IPXEnabled + "</td>"); document.write("<td>" + p.IPXNetworkNumber + "</td>"); document.write("<td>" + p.MACAddress + "</td>"); document.write("<td>" + p.WINSPrimaryServer + "</td>"); document.write("<td>" + p.WINSSecondaryServer + "</td>"); document.write("</tr>"); } document.write("</table>"); 

}

Thus, it uses an ActiveX object, which appears to be installed from the OS to achieve this. Is it possible to do something similar with a terminal service session? Get information about the client network of the terminal? (Not the network information about the terminal server that would have been shown in the previous example when starting a Terminal Services session).

I think maybe there is another Active X object to accomplish this?

+1
internet-explorer activex terminal-services
source share
2 answers

Basically, there are two ways to get a clientโ€™s name / address:

  • Use MFCOM, namely the MetaFrameSession object.
  • Using WMI, the MetaFrame_ICA_Client class in root\Citrix looks promising.

The drawback of the mayor of both solutions is that they require more user rights than you could give. From what I read, at least the โ€œView Accountโ€ permissions are required in Citrix, but I have no way to check it right now. I could not get myself to work as a regular user.

To give you an idea, accessing information with MFCOM would look something like this:

 var MetaFrameSessionObject = 6; var oShell = new ActiveXObject("WScript.Shell"); var oSession = new ActiveXObject("MetaFrameCOM.MetaFrameSession"); oSession.Initialize( MetaFrameSessionObject, oShell.ExpandEnvironmentStrings("%COMPUTERNAME%"), oShell.ExpandEnvironmentStrings("%SESSIONNAME%"), -1 ); alert(oSession.ClientAddress); 
+1
source share

If the user is logged on to the terminal server and visits the page in Internet Explorer in this TS session, then Internet Explorer (and any ActiveX controls that it creates) runs on the terminal server hardware, and not on the client hardware.

From this point of view, the only code running on the client hardware is the terminal services client software. In order to get network information about the hardware / network of the Terminal Services client / etc, you will have to run the code on the client hardware.

0
source share

All Articles