New in version 2.5.
whoami /all
command.whoami
such as logon metadata like logon rights, id, type.Note
- name: get whoami information win_whoami:
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description | |
---|---|---|---|
account complex | success | The running account SID details. | |
sid str | success | The SID in string form. Sample: S-1-5-21-1654078763-769949647-2968445802-500 | |
type str | success | The type of SID. Sample: User | |
account_name str | success | The account name of the account SID. Sample: Administrator | |
domain_name str | success | The domain name of the account SID. Sample: DOMAIN | |
authentication_package str | success | The name of the authentication package used to authenticate the user in the session. Sample: Negotiate | |
dns_domain_name str | success | The DNS name of the logon session, this is an empty string if this is not set. Sample: DOMAIN.COM | |
groups list | success | A list of groups and attributes that the user is a member of. Sample: [{'attributes': ['Mandatory', 'Enabled by default', 'Enabled'], 'domain_name': 'DOMAIN', 'type': 'Group', 'account_name': 'Domain Users', 'sid': 'S-1-5-21-1654078763-769949647-2968445802-513'}, {'attributes': ['Mandatory', 'Enabled by default', 'Enabled', 'Owner'], 'domain_name': 'BUILTIN', 'type': 'Alias', 'account_name': 'Administrators', 'sid': 'S-1-5-32-544'}] | |
impersonation_level str | success | The impersonation level of the token, only valid if token_type is TokenImpersonation , see https://msdn.microsoft.com/en-us/library/windows/desktop/aa379572.aspx.Sample: SecurityAnonymous | |
label complex | success | The mandatory label set to the logon session. | |
sid str | success | The SID in string form. Sample: S-1-16-12288 | |
type str | success | The type of SID. Sample: Label | |
account_name str | success | The account name of the label SID. Sample: High Mandatory Level | |
domain_name str | success | The domain name of the label SID. Sample: Mandatory Label | |
login_domain str | success | The name of the domain used to authenticate the owner of the session. Sample: DOMAIN | |
login_time str | success | The logon time in ISO 8601 format Sample: 2017-11-27T06:24:14.3321665+10:00 | |
logon_id int | success | The unique identifier of the logon session. Sample: 20470143 | |
logon_server str | success | The name of the server used to authentcate the owner of the logon session. Sample: DC01 | |
logon_type str | success | The logon type that identifies the logon method, see https://msdn.microsoft.com/en-us/library/windows/desktop/aa380129.aspx. Sample: Network | |
privileges dict | success | A dictionary of privileges and their state on the logon token. Sample: {'SeRemoteShutdownPrivilege': 'disabled', 'SeDebugPrivilege': 'enabled', 'SeChangeNotifyPrivileges': 'enabled-by-default'} | |
rights list | success and running user is a member of the local Administrators group | A list of logon rights assigned to the logon. Sample: ['SeNetworkLogonRight', 'SeInteractiveLogonRight', 'SeBatchLogonRight', 'SeRemoteInteractiveLogonRight'] | |
token_type str | success | The token type to indicate whether it is a primary or impersonation token. Sample: TokenPrimary | |
upn str | success | The user principal name of the current user. Sample: | |
user_flags str | success | The user flags for the logon session, see UserFlags in https://msdn.microsoft.com/en-us/library/windows/desktop/aa380128. Sample: Winlogon |
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.
For a list of other modules that are also maintained by the Ansible Community, see here.
Hint
If you notice any issues in this documentation you can edit this document to improve it.
© 2012–2018 Michael DeHaan
© 2018 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.7/modules/win_whoami_module.html