SYNOPSIS
userinfo
[
userinfo
(
userinfo
DESCRIPTION
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.
Options
-a -
adds a user. Each user-name given on the command line is added.
-b -
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.
-d -
deletes a user. Each user-name given on the command line is deleted.
-D domain-name-
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.
The
-D and-S options 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.
-f fieldname:value-
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.
- Note:
-
PasswordDoesnotExpire takes precedence over PasswordExpired. If PasswordDoesnotExpire is set, 8.1/2012R2/10/2016/2019/11/2022 ignores whether or not PasswordExpired is set.
For a more complete description of these fields, consult the 8.1/2012R2/10/2016/2019/11/2022 administrative documentation.
-n -
restricts output to the normal user accounts.
-S hostname-
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 //.
The
-D and-S options are mutually exclusive. -s -
sorts user list.
- Note:
-
When using the
-s option with the-b option to produce a sorted brief list of users, the list is actually generated faster than just using the-b option.
-t -
restricts output to the server and interdomain trust accounts.
If none of
-n ,-w , or-t options are given, userinfo behaves as if all three were specified. If any-f options 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
-f option) updated. -w -
restricts output to the workstation trust accounts.
EXAMPLES
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
DIAGNOSTICS
Possible exit status values are:
PORTABILITY
Windows 8.1. Windows Server 2012 R2. Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022.
AVAILABILITY
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
SEE ALSO
PTC MKS Toolkit 10.4 Documentation Build 39.