Manage Windows users with the net user command
NOTE: This currently only works with local user accounts, not domain accounts
salt.modules.win_useradd.
add
(name, password=None, uid=None, gid=None, groups=None, home=False, shell=None, unique=False, system=False, fullname=False, roomnumber=False, workphone=False, homephone=False, loginclass=False, createhome=False)¶Add a user to the minion
CLI Example:
salt '*' user.add name password
salt.modules.win_useradd.
addgroup
(name, group)¶Add user to a group
CLI Example:
salt '*' user.addgroup username groupname
salt.modules.win_useradd.
chfullname
(name, fullname)¶Change the full name of the user
CLI Example:
salt '*' user.chfullname user 'First Last'
salt.modules.win_useradd.
chgroups
(name, groups, append=True)¶Change the groups this user belongs to, add append=False to make the user a member of only the specified groups
CLI Example:
salt '*' user.chgroups foo wheel,root True
salt.modules.win_useradd.
chhome
(name, home, persist=False)¶Change the home directory of the user, pass True for persist to move files to the new home directory if the old home directory exist.
CLI Example:
salt '*' user.chhome foo \\fileserver\home\foo True
salt.modules.win_useradd.
chprofile
(name, profile)¶Change the profile directory of the user
CLI Example:
salt '*' user.chprofile foo \\fileserver\profiles\foo
salt.modules.win_useradd.
current
(sam=False)¶Get the username that salt-minion is running under. If salt-minion is running as a service it should return the Local System account. If salt is running from a command prompt it should return the username that started the command prompt.
New in version 2015.5.6.
Parameters: | sam (bool) -- False returns just the username without any domain notation. True returns the domain with the username in the SAM format. Ie:
|
---|---|
Returns: | Returns False if the username cannot be returned. Otherwise returns the username. |
Return type: | bool str |
CLI Example:
salt '*' user.current
salt.modules.win_useradd.
delete
(name, purge=False, force=False)¶Remove a user from the minion NOTE: purge and force have not been implemented on Windows yet
CLI Example:
salt '*' user.delete name
salt.modules.win_useradd.
getent
(refresh=False)¶Return the list of all info for all users
CLI Example:
salt '*' user.getent
salt.modules.win_useradd.
info
(name)¶Return user information
CLI Example:
salt '*' user.info root
salt.modules.win_useradd.
list_groups
(name)¶Return a list of groups the named user belongs to
CLI Example:
salt '*' user.list_groups foo
salt.modules.win_useradd.
list_users
()¶Return a list of users on Windows
salt.modules.win_useradd.
removegroup
(name, group)¶Remove user from a group
CLI Example:
salt '*' user.removegroup username groupname
salt.modules.win_useradd.
rename
(name, new_name)¶Change the username for a named user
CLI Example:
salt '*' user.rename name new_name
salt.modules.win_useradd.
setpassword
(name, password)¶Set a user's password
CLI Example:
salt '*' user.setpassword name password