Jump to content

kcpoole

Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by kcpoole

  1. I have made a New function that does this and checks for nested groups ( see my own posts earlier), and the usage is exactly the same for _ADismemberof if _ADRecursiveIsMemberOf (_ADSamAccountNametoFQDN("APP-MS Office2007"),$user) Then MsgBox ( 0, "Groups", "You are a member of APP-MS Office2007", 10 ) Else MsgBox ( 0, "Groups", "You are NOT a member of APP-MS Office2007", 10 ) EndIf Ken
  2. Thanks ARCs This is also in V3.12 which is what I have but it does not do the same, nor is it a replacement for the _ADIsMemberOf. _ADRecursiveGetMemberOf Will build an array of Groups the user is a member of, but what I need is a one line method to test if a user is in an AD group or not. These groups are recursive. I am building an exe to call from Login script that will check whether a user is in application group or not, if is then do something, ( run installer, Create shortcuts, Import reg files, Etc). If not in the group then do somthing else. eg uninstall software, Delete files etc.. then continue to the next check. Sample Code I want to use in my app if _ADRecursiveIsMemberOf (_ADSamAccountNametoFQDN("APP-MS Office2007"),$user) Then MsgBox ( 0, "Groups", "You are a member of APP-MS Office2007", 10 ) Else MsgBox ( 0, "Groups", "You are NOT a member of APP-MS Office2007", 10 ) EndIf If i used _ADRecursiveGetMemberOf, then I woud have to parse the Array everytime I want to do another test which will bulk out the script ineed to run making it less obvious to use I have Got a working Version of my script and added it to my copy of ADfunctions to use as an include statement maybe some smarter coders than I can have a look at it to improve it. If found to be useful, then maybe can be added back to ADFunctions for everyone to use. Ken
  3. Hi all I have come up with this which seems to work OK. Can yo all have a look and see if it can be improved in any way. Thanks Ken Func _ADRecursiveISMemberOf(ByRef $memberof, $fqdn) _ADRecursiveGetMemberOf($avGroups, $User); Create an array of all groups the User is a member of For $i = 0 To $avGroups[$i] ; loop for every entry in the Array If @error = 1 then ExitLoop If StringInStr($avGroups[$i], "|") Then $currgroup = StringLeft($avGroups[$i], StringInStr($avGroups[$i], "|") - 1) Else $currgroup = $avGroups[$i] EndIf $currgroup = StringReplace($currgroup, "/", "\/"); Current group is the FullyQualified Group name the user is member of for this iteration ;MsgBox(0,"","Current Group " & $currgroup ) If $currgroup = $FQDNgroup Then Return -1 EndIf Next EndFunc
  4. Re _ADIsMemberOf How can i make a version of this Function that will check Nested groups? The exact same funcionality but for nested groups would be relly great if anyone can help me TIA Ken
×
×
  • Create New...