The userinfo command displays user information (for one or all users), adds or deletes users, and updates information associated with a user.
userinfo can take three forms:
If none of the add (
-a), update ( -u) or delete ( -d) options are specified, userinfo displays either all known users on the system, or only users specified on the command line.
If the add (
-a) or update ( -u) option is given, users must be specified on the command line. The specified user fields are set as part of the add or updated accordingly.
Otherwise, the delete (
-d) option must be specified; each user given on the command line is deleted.
adds a user. Each user-name given on the command line is added.
produces brief output. One line of output is displayed for each account; it contains three tab delimited fields. The first is the account name, the second the Full Name field, and the third the Comment field.
deletes a user. Each user-name given on the command line is deleted.
locates the primary domain controller for the specified domain, and requests that machine to perform the actions on behalf of the userinfo command. userinfo normally performs actions on the local system.
-Dand -Soptions are mutually exclusive. -e
displays the error number contained in the errno variable for any system error that occurs and exits. You can use the strerror utility to display the system error message corresponding to this error number.
assigns a value to a specified fieldname associated with users. The following fieldnames are currently accepted:
FullName Full name of the user. Password User's password. Comment Comment associated with the user. UserComment A second comment field. HomeDirDrive Drive where home directory resides. HomeDir Directory for user's home. Profile User Profile File. LogonScript User Logon Script name. AccountDisable Yes/No. Disables or enables the user's account. Lockout No. Clears the account lockout flag if the security system has locked it out. PasswordExpired Yes/No. Indicates that the user's password has expired. PasswordNotRequired Yes/No. Indicates that a password is not required to log onto the account. PasswordCannotChange Yes/No. Indicates that the user is permitted to change their password. PasswordDoesNotExpire Yes/No. Indicates that the user's password doesn't expire.
PasswordDoesnotExpire takes precedence over PasswordExpired. If PasswordDoesnotExpire is set, 7/2008R2/8/2012/10/2016 ignores whether or not PasswordExpired is set.
For a more complete description of these fields, consult the 7/2008R2/8/2012/10/2016 administrative documentation.
restricts output to the normal user accounts.
specifies the host machine that the userinfo command requests to perform actions on its behalf. userinfo normally performs actions on the local system. Optionally, hostname may be preceded by \\ or //.
-Dand -Soptions are mutually exclusive. -s
sorts user list.
When using the
-soption with the -boption to produce a sorted brief list of users, the list is actually generated faster than just using the -boption. -t
restricts output to the server and interdomain trust accounts.
If none of
-n, -w, or -toptions are given, userinfo behaves as if all three were specified. If any -foptions are given, they apply to all users added. -u
updates a user. Each user-name given on the command line has one or more fields (specified with the
-foption) updated. -w
restricts output to the workstation trust accounts.
You can use the script described here to automatically create user names on multiple machines, conforming to local policy. A sample invocation of this script looks like
adduser "John Doe" 123
This example is very minimized. Logon scripts could be copied, a mandatory profile copied to a central profile directory, permissions given for various other directories, and so on. The caller must have administrator privileges.
if [ $# -ne 2 ] then print Usage: adduser full-name employee-number >&2 exit 1 fi empno=$2 # # Create a user name with the first character of the first name; and # the full last name. # fullname=$1 set -- $fullname uname=$(cut -b1 $1) shift uname="$uname$*" homedir=//server1/homedirs/$uname mkdir $homedir chown $uname $homedir chacl -g $uname:f $homedir for sys in server1 server2 server3 do userinfo -S '\\'$sys -a \ -f FullName:"$fullname" \ -f HomeDir:$homedir \ -f Password:$empno \ -f Comment:"Employee #$empno" \ $uname member -u $uname -a accounting done echo User $uname created with home directory $homedir
Possible exit status values are:
Windows 7. Windows Server 2008 R2. Windows 8. Windows Server 2012. Windows 10. Windows Server 2016.
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
PTC MKS Toolkit 10.1 patch 1 Documentation Build 2.