Jump to content

Finding User Accounts


Recommended Posts

Trying to find out if a USer is an ADMIN , POWER USER , USER , REMOTE DESKTOP USER , ETC.. So far I have had no problem checking with ISADMIN () to see if its an admin , But what kind of user is it ???

:whistle:

Link to comment
Share on other sites

Trying to find out if a USer is an ADMIN , POWER USER , USER , REMOTE DESKTOP USER , ETC.. So far I have had no problem checking with ISADMIN () to see if its an admin , But what kind of user is it ???

:whistle:

Come on All you Very smart people .. I know there must be a way to find this out...

Link to comment
Share on other sites

Come on All you Very smart people .. I know there must be a way to find this out...

List group membership for the user. You could list each of those groups, looking for the user, but that's the hard way:

#include <array.au3>

$Domain = @ComputerName
$User = @UserName
$oUser = ObjGet("WinNT://" & $Domain & "/" & $User)
Dim $avGroups[1] = [0]
If IsObj($oUser) Then
    $colGroups = $oUser.Groups
    For $oGroup In $colGroups
        _ArrayAdd($avGroups, $oGroup.name)
    Next
    $avGroups[0] = UBound($avGroups) - 1
    _ArrayDisplay($avGroups, "Groups for user:")
Else
    MsgBox(16, "Error", "Faile to get object for user: " & $Domain & "/" & $User)
EndIf

:whistle:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

List group membership for the user. You could list each of those groups, looking for the user, but that's the hard way:

#include <array.au3>

$Domain = @ComputerName
$User = @UserName
$oUser = ObjGet("WinNT://" & $Domain & "/" & $User)
Dim $avGroups[1] = [0]
If IsObj($oUser) Then
    $colGroups = $oUser.Groups
    For $oGroup In $colGroups
        _ArrayAdd($avGroups, $oGroup.name)
    Next
    $avGroups[0] = UBound($avGroups) - 1
    _ArrayDisplay($avGroups, "Groups for user:")
Else
    MsgBox(16, "Error", "Faile to get object for user: " & $Domain & "/" & $User)
EndIf

:whistle:

I just keep getting this ERROR MsgBox(16, "Error", "Faile to get object for user: " & $Domain & "/" & $User)

Thats it..

Link to comment
Share on other sites

I just keep getting this ERROR MsgBox(16, "Error", "Faile to get object for user: " & $Domain & "/" & $User)

I tested it before posting with XP Pro SP2. What is your environment, OS, and are you an admin on the box?

:whistle:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

I just keep getting this ERROR MsgBox(16, "Error", "Faile to get object for user: " & $Domain & "/" & $User)

Thats it..

Try replacing $Domain = @ComputerName with $Domain = 'localHost'
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...