Function Reference


_Security__LookupAccountName

Retrieves a security identifier (SID) for the account and the name of the domain

#include <Security.au3>
_Security__LookupAccountName ( $sAccount [, $sSystem = ""] )

Parameters

$sAccount Specifies the account name.
Use a fully qualified string in the domain_name\user_name format to ensure that the function finds the account in the desired domain.
$sSystem [optional] Name of the system.
This string can be the name of a remote computer.
If this string is blank, the account name translation begins on the local system.
If the name cannot be resolved on the local system, this function will try to resolve the name using domain controllers trusted by the local system.

Return Value

Success: an array with the following format:
    $aAcct[0] - SID String
    $aAcct[1] - Domain name
    $aAcct[2] - SID type
Failure: sets the @error flag to non-zero.

Related

_Security__LookupAccountSid

See Also

Search LookupAccountName in MSDN Library.

Example

#include <Security.au3>

Local $aArrayOfData = _Security__LookupAccountName(@UserName)

; Print returned data if no error occured
If IsArray($aArrayOfData) Then
        ConsoleWrite("SID String = " & $aArrayOfData[0] & @CRLF)
        ConsoleWrite("Domain name = " & $aArrayOfData[1] & @CRLF)
        ConsoleWrite("SID type = " & _Security__SidTypeStr($aArrayOfData[2]) & @CRLF)
EndIf