#AutoIt3Wrapper_outfile=\\UWKP00076851\c$\users\ucap00076851\desktop\test.exe #RequireAdmin Global $UserName = _GetUsername() Global $getSID ; ---------------------------------- ; --- Gets SID of logged in User --- ; ---------------------------------- $strComputer = "." $strNamespace = "\root\cimv2" $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $strComputer & $strNamespace) $objAccount = $objWMIService.Get("Win32_UserAccount.Name='" & @UserName & "',Domain='CANADA'") ;$objAccount = $objWMIService.Get("Win32_UserAccount.Name='" & $UserName & "',Domain='CANADA'") $getSID = $objAccount.SID MsgBox(0, "Admin ID", @UserName) MsgBox(0, "Local User", $UserName) MsgBox(0, "SID", $getSID) Func _GetUsername() Local $aResult = DllCall("Wtsapi32.dll", "int", "WTSQuerySessionInformationW", "int", 0, "dword", -1, "int", 5, "dword*", 0, "dword*", 0) If @error Or $aResult[0] = 0 Then Return SetError(1, 0, 0) Local $sUsername = BinaryToString(DllStructGetData(DllStructCreate("byte[" & $aResult[5] & "]", $aResult[4]), 1), 2) DllCall("Wtsapi32.dll", "int", "WTSFreeMemory", "ptr", $aResult[4]) Return $sUsername EndFunc ;==>_GetUsername