Share via


ComputerName Property

 

Returns the name of the computer system.

Syntax

object.ComputerName 

Arguments

  • object
    WshNetwork object.

Remarks

The ComputerName property contains a string value indicating the name of the computer system.

Applies To:

WshNetwork Object

The following example demonstrates the use of the ComputerName property.

<package>
   <job id="vbs">
      <script language="VBScript">
         Set WshNetwork = WScript.CreateObject("WScript.Network")
         WScript.Echo "Domain = " & WshNetwork.UserDomain
         WScript.Echo "Computer Name = " & WshNetwork.ComputerName
         WScript.Echo "User Name = " & WshNetwork.UserName
      </script>
   </job>

   <job id="js">
      <script language="JScript">
         var WshNetwork = WScript.CreateObject("WScript.Network");
         WScript.Echo("Domain = " + WshNetwork.UserDomain);
         WScript.Echo("Computer Name = " + WshNetwork.ComputerName);
         WScript.Echo("User Name = " + WshNetwork.UserName);
         }
      </script>
   </job>
</package>

See Also

Unable to find linked topic '3D348B43-F98A-43DD-986B-93ADFF7945FE'.