Jump to content

Recommended Posts

Excuse... :">

The "ingroup" UDF i download from this site.

That is the code:

---------------------------------------------------------------------------

Func InGroup($GROUP)

$groupnamelength = StringLen ($group)

If $groupnamelength > 21 Then

$groupnamelength = 21

EndIf

$groupnamearray = StringSplit ($GROUP,"")

$group = ""

For $groupcharactercount = 1 to $groupnamelength

$group=$group & $groupnamearray[$groupcharactercount]

Next

;Get the user details and pipe to a text file

$tempfile = tempfile()

RunWait(@ComSpec & " /c net user /Domain" & " " & @UserName & " >" & $tempfile, "", @SW_HIDE)

; Open textfile output from cmd net user

$FILE = FileOpen($tempfile, 0)

; Check if file opened for reading OK

If $FILE = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

EndIf

; Read in file until the EOF is reached, if user is in group return 1 (true) or else 0 (false)

While 1

$LINE = FileReadLine($FILE) & " "

If @error = -1 Then

FileClose($FILE)

FileDelete($tempfile)

ExitLoop

EndIf

If StringInStr($LINE, "*" & $GROUP & " ") Then

FileClose($FILE)

FileDelete($tempfile)

Return 1

EndIf

WEnd

EndFunc ;==>InGroup

-----------------------------------------------------------------------

Note that to know the groups that the user is member of, the function uses the "NET USER" command. This run fine in Windows2000 or XP workstations, but this command is not recognized by Windows95 or 98.

Pierre

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...