Author Topic: IWshNetwork.UserName Property  (Read 2527 times)

0 Members and 1 Guest are viewing this topic.

Offline José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 2524
  • User-Rate: +209/-0
  • Gender: Male
IWshNetwork.UserName Property
« on: July 14, 2008, 08:10:42 AM »

The following example demonstrates the use of the UserName 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)