Export (0) Print
Expand All
Expand Minimize

UserDomain Property

Returns a user's domain name.

                      object.UserDomain

object

WshNetwork object.

String.

The UserDomain property does not work on Windows 98 and Windows Millennium Edition unless the USERDOMAIN environment variable is set. The variable is not set by default.

Description

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

Applies To:

Community Additions

ADD
Show:
© 2014 Microsoft