Author Topic: IWshNetwork.ComputerName Property  (Read 4116 times)

0 Members and 1 Guest are viewing this topic.

Offline José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 2517
  • User-Rate: +209/-0
  • Gender: Male
IWshNetwork.ComputerName Property
« on: July 14, 2008, 08:33:56 PM »

The following code illustrates the use of the ComputerName property:

JScript

Code: [Select]
var WshNetwork = WScript.CreateObject("WScript.Network");
WScript.Echo("Domain = " + WshNetwork.UserDomain);
WScript.Echo("Computer Name = " + WshNetwork.ComputerName);
WScript.Echo("User Name = " + WshNetwork.UserName);

VBScript

Code: [Select]
Set WshNetwork = WScript.CreateObject("WScript.Network")
WScript.Echo "Domain = " & WshNetwork.UserDomain
WScript.Echo "Computer Name = " & WshNetwork.ComputerName
WScript.Echo "User Name = " & WshNetwork.UserName

PowerBASIC

Code: [Select]
DIM pWshNet AS IWshNetwork
pWshNet = NEWCOM "WScript.Network"
PRINT "User name: " & ACODE$(pWshNet.UserName)
PRINT "User domain: " & ACODE$(pWshNet.UserDomain)
PRINT "Computer name: " & ACODE$(pWshNet.ComputerName)