Jump to content
Sign in to follow this  

Get process user level

Recommended Posts

How could I check the running privileges of a process? I mean if it's System level, Local service, Network service or simply user-level. Just like in the task manager :)


Share this post

Link to post
Share on other sites


This is the example from winapiex.au3 for func _WinAPI_GetProcessUser()...


#Include <APIConstants.au3>
#Include <Array.au3>
#Include <WinAPIEx.au3>

Opt('MustDeclareVars', 1)

Global $hToken, $Data, $aAdjust, $aList = 0

; Enable "SeDebugPrivilege" privilege for obtain full access rights to another processes
_WinAPI_AdjustTokenPrivileges($hToken, $SE_DEBUG_NAME, $SE_PRIVILEGE_ENABLED, $aAdjust)

; Retrieve user names for all processes the system
If Not (@error Or @extended) Then
    $aList = ProcessList()
    For $i = 1 To $aList[0][0]
        $Data = _WinAPI_GetProcessUser($aList[$i][1])
        If IsArray($Data) Then
            $aList[$i][1] = $Data[0]
            $aList[$i][1] = ''

; Enable SeDebugPrivilege privilege by default
_WinAPI_AdjustTokenPrivileges($hToken, $aAdjust, 0, $aAdjust)

_ArrayDisplay($aList, '_WinAPI_GetProcessUser')


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...