Module for managing Windows Users
| depends: |
|
|---|
注解
This currently only works with local user accounts, not domain accounts
salt.modules.win_useradd.add(name, password=None, fullname=False, description=None, groups=None, home=None, homedrive=None, profile=None, logonscript=None)¶Add a user to the minion.
| 参数: |
|
|---|---|
| 返回: | True if successful. False is unsuccessful. |
| 返回类型: |
CLI 范例:
salt '*' user.add name password
salt.modules.win_useradd.addgroup(name, group)¶Add user to a group
| 参数: | |
|---|---|
| 返回: | True if successful. False is unsuccessful. |
| 返回类型: |
CLI 范例:
salt '*' user.addgroup jsnuffy 'Power Users'
salt.modules.win_useradd.chfullname(name, fullname)¶Change the full name of the user
| 参数: | |
|---|---|
| 返回: | True if successful. False is unsuccessful. |
| 返回类型: |
CLI 范例:
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
| 参数: | |
|---|---|
| 返回: | True if successful. False is unsuccessful. |
| 返回类型: |
CLI 范例:
salt '*' user.chgroups jsnuffy Administrators,Users 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.
| 参数: | |
|---|---|
| 返回: | True if successful. False is unsuccessful. |
| 返回类型: |
CLI 范例:
salt '*' user.chhome foo \\fileserver\home\foo True
salt.modules.win_useradd.chprofile(name, profile)¶Change the profile directory of the user
| 参数: | |
|---|---|
| 返回: | True if successful. False is unsuccessful. |
| 返回类型: |
CLI 范例:
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.
2015.5.6 新版功能.
| 参数: | sam (bool) -- False returns just the username without any domain notation. True returns the domain with the username in the SAM format. Ie:
|
|---|---|
| 返回: | Returns False if the username cannot be returned. Otherwise returns the username. |
| 返回类型: | bool str |
CLI 范例:
salt '*' user.current
salt.modules.win_useradd.delete(name, purge=False, force=False)¶Remove a user from the minion
| 参数: |
|
|---|---|
| 返回: | True if successful |
| 返回类型: |
CLI 范例:
salt '*' user.delete name
salt.modules.win_useradd.getUserSid(username)¶Get the Security ID for the user
| 参数: | username (str) -- user name for which to look up the SID |
|---|---|
| 返回: | Returns the user SID |
| 返回类型: | str |
CLI 范例:
salt '*' user.getUserSid jsnuffy
salt.modules.win_useradd.getent(refresh=False)¶Return the list of all info for all users
| 参数: | refresh (bool) -- Refresh the cached user information. Default is False. Useful when used from within a state function. |
|---|---|
| 返回: | A dictionary containing information about all users on the system |
| 返回类型: | dict |
CLI 范例:
salt '*' user.getent
salt.modules.win_useradd.info(name)¶Return user information
| 参数: | name (str) -- Username for which to display information |
|---|---|
| 返回: |
|
| 返回类型: | dict |
CLI 范例:
salt '*' user.info jsnuffy
salt.modules.win_useradd.list_groups(name)¶Return a list of groups the named user belongs to
| 参数: | name (str) -- user name for which to list groups |
|---|---|
| 返回: | list of groups to which the user belongs |
| 返回类型: | list |
CLI 范例:
salt '*' user.list_groups foo
salt.modules.win_useradd.list_users()¶Return a list of users on Windows
| 返回: | list of users on the system |
|---|---|
| 返回类型: | list |
CLI 范例:
salt '*' user.list_users
salt.modules.win_useradd.removegroup(name, group)¶Remove user from a group
| 参数: | |
|---|---|
| 返回: | True if successful. False is unsuccessful. |
| 返回类型: |
CLI 范例:
salt '*' user.removegroup jsnuffy 'Power Users'
salt.modules.win_useradd.rename(name, new_name)¶Change the username for a named user
| 参数: | |
|---|---|
| 返回: | True if successful. False is unsuccessful. |
| 返回类型: |
CLI 范例:
salt '*' user.rename jsnuffy jshmoe
salt.modules.win_useradd.setpassword(name, password)¶Set the user's password
| 参数: | |
|---|---|
| 返回: | True if successful. False is unsuccessful. |
| 返回类型: |
CLI 范例:
salt '*' user.setpassword jsnuffy sup3rs3cr3t
salt.modules.win_useradd.update(name, password=None, fullname=None, description=None, home=None, homedrive=None, logonscript=None, profile=None, expiration_date=None, expired=None, account_disabled=None, unlock_account=None, password_never_expires=None, disallow_change_password=None)¶Updates settings for the windows user. Name is the only required parameter. Settings will only be changed if the parameter is passed a value.
2015.8.0 新版功能.
| 参数: |
|
|---|---|
| 返回: | True if successful. False is unsuccessful. |
| 返回类型: |
CLI 范例:
salt '*' user.update bob password=secret profile=C:\Users\Bob
home=\\server\homeshare\bob homedrive=U: