Retrieving Computer name using scripts (works on Remote system)


<form name="Master" method="post"
action=””>
<input type="label" name="TerminalId" value="S"
>

Set
Sh = CreateObject(“WScript.Shell”)
sys =
Sh.ExpandEnvironmentStrings(“%CLIENTNAME%”)
User =
CreateObject(“WScript.Network”).Username
Server =
CreateObject(“WScript.Network”).computername
//MsgBox(user & ” ” &
sys & ” to ” & server)
//Wscript.Echo “Logon By ” & User & “
from ” & sys & ” On to ” & Server

<script
type=”text/javascript”>
var network = new
ActiveXObject(“WScript.Network”);

document.Master.TerminalId.value = network.ComputerName + “.” +
network.UserDomain;
//alert(network.ClientName);
//alert(sys);

//var
sh = new ActiveXObject(“WScript.Shell”)
//var sys =
sh.ExpandEnvironmentStrings(“%CLIENTNAME%”)
//alert(sh.clientAddress);

//var
WTS = new ActiveXObject(“WTSManager.Shell”)
//alert(WTS.MyClientName + ” My
IP address: ” + WTS.MyIPAddress);
if(sys == ‘%CLIENTNAME%’)
sys =
network.ComputerName;
if(Server == sys)
Server =
network.UserDomain;

<script
type=”text/javascript”>
alert(sys + ” – ” + server + ‘ – ‘ +
network.UserDomain);

The script will fetch the parameter from the ysstem variable and extract the computer name logged in or the current one.

Advertisements

Leave a Reply / Comment

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s