Is user member of group in C#

Hello everyone,
I have to bind our application from ActiveDirectory to eDirectory. Is
there a simple way to determine if the currently logged in user is a
member of a group?
In ActiveDirectory this is really simple but in eDirectory (using the
LDAP C#-library) it seems that I always have to create LDAP strings
which always have to contain username and password (which is an
absolutely no-go in my opinion).
I found many articles to my problem but no one with an easy solution.
Perhaps someone got this running without the novell LDAP library through
Microsoft DirectoryServices-Namespace.
inno1
inno1's Profile: http://forums.novell.com/member.php?userid=109362
View this thread: http://forums.novell.com/showthread.php?t=437637

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
A few things come to mind. First your authentication problem; binding
anonymously is definitely allowed in eDirectory, and is even allowed by
default, but that doesn't mean the environment you are hitting will allow
it. This is something you'll need to check with whomever setup the
eDirectory environment. The documentation should cover how to set
restrictions like anonymous binds.
Next we have what I'm guessing is how you are searching for the group. I
do not see how you are going to find either your group or your user in the
group using that code so I'll suggest something else that I think is
better taking advantage of the power of eDirectory and LDAP. First a
little more information about eDirectory. By default group memberships
are shown on both the group and user sides so you can either query the
entire directory for groups that have users in their 'members' attribute,
or you can go to the user and simply get a listing of all of the values in
the groupMembership attribute. This is the best way, in my opinion, to
see if a user is a member of a group.
Now, about finding the user. In LDAP environments objects are found by
full DNs, not just their relative DNs or usernames. If you do not have a
full DN (users seldom know the full DN or use them) the first step is to
find these, which you can do with a search like you are doing, although
hopefully you wouldn't need to loop through results. Having a query like
the following should find the user in one shot in a well-designed environment:
(&(objectClass=inetorgperson)(cn=userNameHere))
Once you have found the resulting DN of the user you can find the
groupMembership attribute and either use the full set of values in that
attribute or you can iterate through the values looking for the group DN.
For both user and group you must use the full DN to verify membership.
Good luck.
On 04/28/2011 02:36 AM, inno1 wrote:
>
> ab;2100491 Wrote:
>> The check for is a user is a member of a group does not require the
>> password...I ask because the samples from the LDAP-library (ListGroup.cs, for
> example) all seem to require a password. The samples check the number of
> command line arguments and if something is missing the program does not
> work.
>
> ab;2100491 Wrote:
>> what do you mean[..]
> I need a function like
> Code:
> --------------------
> bool UserIsMemberOf(string groupName) {}
> --------------------
> to determine if a user is a member of a group.
>
> I get the userName from Environment.UserName and the groupName the user
> has to be a member of is configured somewhere in my application.
>
> In ActiveDirectory I just connect to LDAP://RootDSE and everything
> works fine.
>
> ab;2100491 Wrote:
>> [..] and what does your code look like?
> I used the 'Using .NET C# LDAP Library'
> (http://www.novell.com/coolsolutions/...e/11204.html):
>
>
> Code:
> --------------------
> Anonymous Binding
>
> // C# Library namespace
> using Novell.Directory.Ldap;
>
> // Creating an LdapConnection instance
> LdapConnection ldapConn= new LdapConnection();
>
> //Connect function will create a socket connection to the server
> ldapConn.Connect (ldapHost,ldapPort);
>
> //Bind function with null user dn and password value will perform anonymous bind
> //to LDAP server
> ldapConn.Bind (null, null);
> --------------------
>
> After this ldapConn.Bound is false. Is this correct? It could be
> correct because I didn't really authenticate when doing anonymous
> binding but it could be also wrong because even an anonymous bind should
> be a form of authentication.
>
> I also tried Identity Bind:
>
>
> Code:
> --------------------
> Binding using an Identity
>
> // C# Library namespace
> using Novell.Directory.Ldap;
>
> // Creating an LdapConnection instance
> LdapConnection ldapConn= new LdapConnection();
>
> //Connect function will create a socket connection to the server
> ldapConn.Connect(ldapHost,ldapPort);
>
> //Bind function will Bind the user object Credentials to the Server
> ldapConn.Bind(userDN,userPasswd);
> --------------------
> After this, ldapConn.Bound is true but the user has to give a password.
> I don't want the user to have to use a password because in this case the
> user has to configure it somewhere in the configuration of my
> application.
>
> Then - for testing purposes - I wrote a function to get the users of a
> group:
>
>
> Code:
> --------------------
> LdapSearchResults lsc=ldapConn.Search("ou=Users,o=DomainAdmins", LdapConnection.SCOPE_ONE, "objectClass=*", null, false);
>
> string result = String.Empty;
>
> while (lsc.hasMore()) {
> LdapEntry nextEntry = null;
>
> try {
> nextEntry = lsc.next(); // <--- EXCEPTION: see [1]
> } catch(LdapException e) {
> result = String.Concat(result, "Error: ", e.LdapErrorMessage, Environment.NewLine);
> // Exception is thrown, go for next entry
> continue;
> }
>
> result = String.Concat(result, nextEntry.DN, Environment.NewLine);
>
> LdapAttributeSet attributeSet = nextEntry.getAttributeSet();
> System.Collections.IEnumerator ienum = attributeSet.GetEnumerator();
>
> while(ienum.MoveNext()) {
> LdapAttribute attribute=(LdapAttribute)ienum.Current;
> string attributeName = attribute.Name;
> string attributeVal = attribute.StringValue;
> result = String.Concat(result, attributeName, "value:", attributeVal, Environment.NewLine);
> }
> }
> --------------------
>
>
> [1] "00000000: LdapErr: DSID-0C090627, comment: In order to perform
> this operation a successful bind must be completed on the connection.
>
> I think this is the problem:
>
>
> Code:
> --------------------
> LdapSearchResults lsc=ldapConn.Search("ou=Users,o=DomainAdmins", LdapConnection.SCOPE_ONE, "objectClass=*", null, false);
> --------------------
>
>
> So, how does this have to look for a domain named "MyDomain.com" for a
> group named "DomainAdmins" if I want to get all members of this group?
>
> And how does this have to look if I want to know if a user named
> "myuser" is member of a group "mygroup" in domain "MyDomain.com"?
>
> I think this would help me a lot.
>
> ab;2100491 Wrote:
>> There may be a need for authentication that would require a
>> username/password but that depends on the rights you assign to your
>> tree
>> to allow (or deny) anonymous access.So, this is someone the customer has to configure I think. Since I only
> want to read from a domain it has to work some way without giving a
> password.
>
> ab;2100491 Wrote:
>> Good luck.Thank you very much!
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.15 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQIcBAEBAgAGBQJNujvFAAoJEF+XTK08PnB5Vn4QAJ8wDKZw5h Q5AWWkeMhKZ57U
DctNKO9Wl1xU3agTp+PjgFFCQMHTiME7/UFU7/KR+eyY0hgp9R6r0k2lK3iX1TFd
1Zwg0rkEjV+Pydy7vHk/LvqpoyWYKhrSGHhvkj/RChiIj1yEKR0rgAXGZG8NPemO
nIXJtPHQ8ZkH8ZrEGfL+25abIc5b0Ch5KXN76nSFRGORgqPRvO 2gpQW36KKj+Tfq
RZARJgBKyKaG4MOlatnS2ZNuAy1meI/1oTN/ouO8K1MR+Hey2ZvI85VUSlg3nG/z
fgj6QdIMj80KRnpgJCO4K7SFO6effHQaijRUIszz5xHxSEaPXv FcB/xPhRdedzxb
NKZu/rti0Jt3PABCG3nibbUcA05vbb6mLbufwDISJGXyUp5PK3533yT xoGFjkt1I
PL+p7ZpL4Q5s4wHBGME0y579V5EfncqqUsFh2aONzhIAmOSxu0 huaqcLG5QWmQnQ
HMn8+npkdlyGGJy4hslpyoTQefYNsn7PdXig1KAMEZjQHGlI1S WJf/hsztcP4/jM
Zf8oKMZz/35+EphCgRgXl0h5gOFk+WpxHRJ8NyAVLZioV4mcUwBzLDD7d9z lW47/
SZxxlIOKpFB1c0FokkFR2SBteDsd4dzfMPgD7MTDBNj174u7wn y3LkSvWfPTDjBS
12SwchOZ+PPL3PxfsUNc
=/n4u
-----END PGP SIGNATURE-----

Similar Messages

  • Cannot Add user to CMC Group when they are a member of LDAP group

    On PreProduction Server CMC
    Softerra LDAP browser used to verify user is a member of LDAP group
    User does not show as a member of that group in the CMC
    Cannot add user to LDAP group showing in CMC, the same group shows the member in LDAP browser
    On Production Server CMC
    For kicks I logged into the CMC on Production and I found the user is correctly showing as a member of the Group
    Why doesn't the groups in CMC show what is actually showing in the LDAP browser?

    Hi,
    Check if you have also mapped in both servers the same groups. It might be that there are some groups missing in the Pre-prod.
    Also, try restarting the CMS. I have seen similar issues that are solved after forcing the recreation of the graph.
    If after the restart you still can't see the groups, check the mapping on the LDAP server. It might be that both servers do not use the same attribute mappings.
    Regards,
    Julian

  • X groups with each 1 filter agaist same db, user member of more than 1 group

    Hi everybody !I have a problem :I have a set of groupsEach group is assigned 1 filter againstthe same databaseIt works fine, EXCEPT :When 1 user is member of more thanone group it fails with the##1054013 Syntax error loading filters - operation canceledall users have none-access to the dball filters are mutually exclusive,e.g. read a,read b etc.In businessterms : One employee can seeown data (read a)The manager can see own data (read b)BUT the manager can also see employeedata (read a)Group a filter read a against db xGroup b filter read b against db xEmployee is member of group a (No prob)Manager is member of group b (No prob)Manager is also member of group a (PROB!)Thanks in advance from DenmarkCarsten

    Hi everybody !I have a problem :I have a set of groupsEach group is assigned 1 filter againstthe same databaseIt works fine, EXCEPT :When 1 user is member of more thanone group it fails with the##1054013 Syntax error loading filters - operation canceledall users have none-access to the dball filters are mutually exclusive,e.g. read a,read b etc.In businessterms : One employee can seeown data (read a)The manager can see own data (read b)BUT the manager can also see employeedata (read a)Group a filter read a against db xGroup b filter read b against db xEmployee is member of group a (No prob)Manager is member of group b (No prob)Manager is also member of group a (PROB!)Thanks in advance from DenmarkCarsten

  • 713060: Tunnel Rejected: User (user) not member of group (group_name), group-lock check failed.

    Hi,
    I just configure VPN for end users in PIX515e with IOS 8 and get stuck with "Tunnel Rejected: User (msveden) not member of group (VPN-shared), group-lock check failed.". Can someone please help me and tell me how I add user to my VPN group?
    Regards
    Mikael

    May be you are looking for this-
    ASA1(config)# username msveden attributes
    ASA1(config-username)# group-lock value mygroup
    Thanks
    Ajay

  • Need to know how to better manage revolving users in a group

    I have a new Beehive Online group set up for a external partner collaboration. Members of the group are only from Oracle or that external partner. While the BHO group is new, the collaboration has been in place for a long time (since 2007). Initially at Sun Microsystems, and now Oracle.
    In my description here... when I say "collaboration" you can translate that to roughly equivalent to "BHO Group"....
    The nature of the collaboration is that both companies move people to/from the collaboration, depending on the work in progress. I'm not saying there are changes daily, but there can be changes every month or so. It also happens that people working on the collaboration may be moved from it for many months or longer, and then get moved back to the collaboration at a later time. Ie, the may revolve in and out of the collaboration. Trouble is, when they are moved from the collaboration there is no guarantee that they ever get moved back to it. When a person is not part of the collaboration, their access to collaboration info is taken away.
    So my problem is understanding how to manage this better in BHO.
    I need to allow a user to be removed from a group, with the possibility (but not certainty) of adding them again.
    -- my understanding that delete user would then require SysAd intervention to add them back.
    -- I also am not clear on whether deleting the user affects their other group memberships.
    I tried to find out more about locking a user
    -- but it seems like that affects more then the group.
    Whats the recommended way to deal with this?
    Thx!

    I tried deleting the "verified" user using the group creation/manage tool.
    - click "View members"
    - select the checkbox next to the user
    - click the button "Delete (non-Verified Users)"
    Doing that, the user is not removed AND I get an error message in red at the top of the page that says:
    'Only selected non-"Verified" member(s) have been deleted. Go to https://beehiveonline.oracle.com/BOLAdmin.html to delete "Verified" users'
    So I went to the Admin tool:
    - selected my group,
    - selected the user from the list
    - clicked the "Delete User" button above the list.
    Got the warning pop-up about the user needing to be added back by SysAd, ignored it and clicked "OK".
    Got a success pop-up with all kinds of internal response tracking stuff in it. Clicked "OK"
    And the user is gone from the group in the Admin tool. HOWEVER, the user still shows up in the group list in the group create/manage tool.
    Will the user disappear from that list? If not, the list would be misleading.
    Thx!
    --Resii                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • PS Script to find the list of users and the groups in a Workgroup server

    Hi There, could you please explain on how to get a complete list of local users and local groups in a "Workgroup" server to which they belong to using Powershell. I'm able to get the users list but couldn't find any help in finding
    the script to find to which localgroup the user belong to. Anticipating your response. Also let me know the cmdlet for Win2k3 servers to find the same.

    Here's some code from David Pham (don't remember wher I fund this code):
    Trap {"Error: $_"; Break;}
    Function EnumLocalGroup($LocalGroup)
    $Group = [ADSI]"WinNT://$strComputer/$LocalGroup,group"
    "Group: $LocalGroup"
    # Invoke the Members method and convert to an array of member objects.
    $Members= @($Group.psbase.Invoke("Members"))
    ForEach ($Member In $Members)
    $Name = $Member.GetType().InvokeMember("Name", 'GetProperty', $Null, $Member, $Null)
    $Name
    # Specify the computer.
    $strComputer = gc env:computername
    "Computer: $strComputer"
    $computer = [adsi]"WinNT://$strComputer"
    $objCount = ($computer.psbase.children | measure-object).count
    $i=0
    foreach($adsiObj in $computer.psbase.children)
    switch -regex($adsiObj.psbase.SchemaClassName)
    "group"
    { $group = $adsiObj.name
    EnumLocalGroup $group }
    } #end switch
    $i++
    } #end foreach

  • Adding users to PAB group with same last name as existing

    Cannot add user to PAB group when user has same last name as an existing Group member.
    Seems to work, see number tick up and green bar flash, but, never really adds.

    Joea,
    It appears that in the past few days you have not received a response to your
    posting. That concerns us, and has triggered this automated reply.
    Has your problem been resolved? If not, you might try one of the following options:
    - Visit http://support.novell.com and search the knowledgebase and/or check all
    the other self support options and support programs available.
    - You could also try posting your message again. Make sure it is posted in the
    correct newsgroup. (http://forums.novell.com)
    Be sure to read the forum FAQ about what to expect in the way of responses:
    http://forums.novell.com/faq.php
    If this is a reply to a duplicate posting, please ignore and accept our apologies
    and rest assured we will issue a stern reprimand to our posting bot.
    Good luck!
    Your Novell Product Support Forums Team
    http://forums.novell.com/

  • Deleted user from a group returned error message

    I have a group [[email protected]] with serveral users on it. I deleted one user (userA) member of the group from the system. When a user B send an email to the group [email protected] a messages is returned to all of the members of the group notifying that the user is not whithin the group.
    The group [email protected] is a dynamic group.
    From: [email protected]
    To: [email protected]
    Sent: Friday, October 9, 2009 11:12:42 AM
    Subject: Notificación del estado de la entrega
    Este informe se refiere a un mensaje que ha enviado con los siguientes campos de encabezado:
    Message-id: <[email protected]>
    Date: Fri, 09 Oct 2009 11:18:06 -0500
    From: "User"<[email protected]>
    To: [email protected]
    Subject: Test 0ne
    The message can not be delivered to the next recipients:
    Dirección del destinatario: [email protected]
    Dirección original: [email protected]
    Motivo: recipient no longer on server
    - Sun Java(tm) System Messaging Server 7.0-3.01 64bit (built Dec 23 2008)
    libimta.so 7.0-3.01 64bit (built 15:22:04, Dec 23 2008)
    - Delegated Administrator 6.4-3.01 B2008-10-22
    - Solaris 10 10/08 SPARC
    What can be happening??

    bootbk wrote:
    I have a group [[email protected]] with serveral users on it. I deleted one user (userA) member of the group from the system.
    How did you "delete" one user? What was the exact change that you made?
    When a user B send an email to the group [email protected] a messages is returned to all of the members of the group notifying that the user is not whithin the group.
    If there is a problem with a mailing group (vs. a mailing list) then notifications are sent to all members of the group.
    http://msg.wikidoc.info/index.php/Setting_Up_a_Proper_Mailing_List
    The group [email protected] is a dynamic group.
    What filter have you specified for the "dynamic group"?
    Regards,
    Shane.

  • Mapping NT user accounts and groups in BOXI 3.1.i'm getting below error

    Mapping NT user accounts and groups in BOXI 3.1.i'm getting below error
    In BOXI 3.1 CMC
    .NT Authentication is enabled check box is selected.
    In the Mapped NT Member Groups area, entered the NT domain\group in the Add NT Group text box.
    like : secWindowsNT:
    BLRKEC148827D\BusinessObjects NT Users
    getting error like
    "The secWindowsNT security plugin is not enabled. Contact your system administrator for details. (FWB 00002) "

    You shouldn't be using the NT plugin in 3.1, is there a reason you are using this plugin over AD? If you really want to use it you may need to open a case with support and trace the CMS. Are there any groups currently mapped? if you hit update without adding/removing what happens? What if you remove the NT users group and hit update?
    Regards,
    Tim

  • Error when adding an AD user to OID group

    I'm getting a very unhelpful message when trying to add a user to a group using the oiddas console.
    We have synchronized our existing Active Directory ldap into a 10.1.4 OID. We now have an OID group that we want to add existing AD users to. I can select 'Add User' and see the user I want to add. But, after selecting the user the page returns with the single message of 'Error!'. That's it. Also, the page becomes unusable. Clicking tab menus like Configuration or Directory does nothing. You have to log out and back in to get the console to work again
    I can't find anything in the logs......can anyone help?

    Are you using any of the following "Sum, Count, Min, Max, and Avg" as member names, if so then this can generate the error and you would need to change the name.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • How to list users under multiple groups and users sub groups

    Hi, I am stump, which is not hard to do. i have a list of groups and i want to list the users in those groups and then in the next column lists all the citrix only groups for each user. hopefully im describing that correctly. Heres what i have but it is
    not listing the users groups. I am not sure how to proceed.
    $CurrentDate = Get-Date
    $CurrentDate = $CurrentDate.ToString('MM-dd-yyyy_hh-mm-ss')
    $Groupname = "Distribution Lists"
    $excel = New-Object -comobject Excel.Application
    $excel.visible = $True
    $wbook = $excel.Workbooks.Add()
    $wsheet = $wbook.Worksheets.Item(1)
    $wsheet.Cells.Item(1,1) = "Groupname"
    $wsheet.Cells.Item(1,2) = "Member"
    $wsheet.Cells.Item(1,3) = "ACID"
    $wsheet.Cells.Item(1,4) = "Department"
    $range = $wsheet.UsedRange
    $range.Interior.ColorIndex = 19
    $range.Font.ColorIndex = 11
    $range.Font.Bold = $True
    $intRow = 2
    $groups = get-adgroup -Filter * -properties * -Searchbase "OU=Citrix,OU=Permission,OU=Groups,OU=Home Office,OU=domain,DC=Domain,DC=com"
    $targetFile = "c:\temp\$groupname $CurrentDate.csv"
    Add-Content $targetFile "Group;Member;ACID;Department"
    foreach ($group in $groups){
    $groupMembers = get-adgroupmember $group -Recursive | Get-ADUser -Properties Department, DistinguishedName| Where-Object { $_.Enabled -eq 'True' } | Select-Object Name, samaccountname, department, distinguishedname, @{n='MemberOf';e={$_.MemberOf -replace '^cn=([^,]+).+$','$1' -join '; '}
    foreach ($groupMember in $groupMembers){
    $groupName = $group.Name
    $memberName = $groupMember.Name
    $acid = $groupMember.samaccountname
    $groups = $usergroups
    #$department = $groupMember.department
    $department = $groupMember.memberof
    #$DistinguishedName = $gropmember.distinguishedname
    $line = "($groupName)--------($memberName)-----($acid)-------($department)------($usergroups)"
    add-content $targetFile $line
    $wsheet.Cells.Item($intRow,1) = $groupName
    $wsheet.Cells.Item($intRow,2) = $memberName
    $wsheet.Cells.Item($intRow,3) = $acid
    $wsheet.Cells.Item($intRow,4) = $groups
    $wsheet.Cells.Item($intRow,5) = $DistinguishedName
    $intRow++
    $WorkBook.EntureColumn.AutoFit()
    $excel.SaveAs("DL" + "name.xlsx")
    $excel.Close()

    Hi Glacket,
    Below codes should give you headsup.
    This command will give you estimate the result count for each group:
    PS C:\Users\Administrator> Get-ADGroup -Filter {Name -like "TestGroup*"} | Select Name, @{Expression={get-adgroupmember $_ -recursive | Measure | Select -ExpandProperty Count};Label="Count"}
    Name Count
    TestGroup1 7
    TestGroup2 8
    Note that as said earlier we are getting duplicated results(12,13,14) for users belonging to multiple groups. Result is in order as per earlier code's count and order.
    Get-ADGroup -Filter {Name -like "TestGroup*"} | get-adgroupmember -recursive | Select Name,@{Expression={Get-ADPrincipalGroupMembership $_ | Select -ExpandProperty Name};Label="GroupMemberOfName"}
    Name GroupMemberOfName
    User100 {Domain Users, TestGroup1}
    User14 {Domain Users, TestGroup1, TestGroup2}
    User13 {Domain Users, TestGroup1, TestGroup2}
    User12 {Domain Users, TestGroup1, TestGroup2}
    User11 {Domain Users, TestGroup1}
    User10 {Domain Users, TestGroup1}
    User1 {Domain Users, TestGroup1}
    User19 {Domain Users, TestGroup2}
    User18 {Domain Users, TestGroup2}
    User17 {Domain Users, TestGroup2}
    User16 {Domain Users, TestGroup2}
    User15 {Domain Users, TestGroup2}
    User14 {Domain Users, TestGroup1, TestGroup2}
    User13 {Domain Users, TestGroup1, TestGroup2}
    User12 {Domain Users, TestGroup1, TestGroup2}
    Use below to export to CSV:
    Get-ADGroup -Filter {Name -like "TestGroup*"} | get-adgroupmember -recursive | Select Name,@{Expression={Get-ADPrincipalGroupMembership $_ | Select -ExpandProperty Name};Label="GroupMemberOfName"} | Export-Csv C:\ListGroups.csv
    Regards,
    Satyajit
    Please “Vote As Helpful”
    if you find my contribution useful or “Mark As Answer” if it does answer your question. That will encourage me - and others - to take time out to help you.

  • Remove user from multiple groups

    Hello everyone, first time posting here with a question and I apologize if I'm asking in the wrong location.
    To give an idea of what I'm attempting to do, I've recently been developing a vbscript that will take a nightly csv export from my student information system and either create or deactivate student accounts based upon their enrollment status.  I have
    this function working great now, another function I've been developing is to have accounts moved between OU's based upon the school building code assigned to students which I have working as well.  The problem I'm running into right now is having students
    removed from existing active directory groups when they move between OU's.  Essentially what I would like to do is have the script load the users group membership into an array and then remove any groups that end with STUDENTS, below is the code I have
    been working on to accomplish this but have literally hit a brick wall.  If it helps all my student groups for each location runs in this fashion.
    ABCD_STUDENTS
    ABCE_STUDENTS
    Any suggestions would be greatly appreciated.
    ' Student changing OU then we need to update their account to reflect appropriate group memberships.
    Set UserObj = GetObject("WinNT://server.domain.net/" & ADusrname) 'This must be hardcoded to domain controller
    strUserDN = DN
    strUserCN = objuser.cn
    'Add user to the school group if not correct
    Set objGroup = GetObject(varSchoolGroup)
    strUserDN = DN ' Bind to the user object.
    strGroupDN = varSchoolGroup ' Specify group Distinguished Name and check for membership.
    Set objADObject = GetObject("LDAP://"& strUserDN)
    objmemberOf = objadobject.GetEx("memberOf")
    If Not (funIsMember (GetObject("LDAP://" & strUserDN),varSchoolGroup)) Then
    objmemberOf = objadobject.GetEx("memberOf")
    For Each objGroup in objmemberOf
    Set objGroupDelete = GetObject ("LDAP://" & objGroup)
    If Mid(objgroup,7,8) = "STUDENTS" Then
    msgbox "test remove"
    objGroupDelete.PutEx ADS_PROPERTY_DELETE,"member",Array(strUserDN)
    objGroupDelete.setinfo
    subUpdateLogFile studentcounter & " - Removed from student group " & objgroup,student_guid,student_username,student_fullname,"removed group"
    End If
    Next
    'Add user to school group
    Set objGroup = GetObject(varSchoolGroup)
    objGroup.PutEx ADS_PROPERTY_APPEND, "member", Array(struserdn)
    objGroup.SetInfo
    subUpdateLogFile studentcounter & " - Updated school group to " & student_schoolgroup_ldap,student_guid,student_username,student_fullname,"school group"
    objUser.SetInfo
    updated = "yes"
    End If
    Any suggestions would be greatly appreciated.

    With Bill.  This can be done with AD and PowerShell in a couple of lines for reach item.
    You are taking an incorrect approach which is making this much harder than it needs to be.  Your question is also hard to understand.
    Each AD usre object obtained via ADSI will have a list of groups the account is a member of.  You use this to remove the user from the group.  How you choose this is up to you.  You can use an array or a file.  You can also =just use
    OU associated groups.  A user then is added to all or some groups associated with the OU and removed from the groups associated with the OU by just returning the OU associated group list from the OUs.
    Designing AD systems is a specialty.  Once you fully understand the features and capabilities of AD these things are usually simple and painless.  If the design is not done well they are painful and faulty.
    We can answer specific questions.  Understaning the design and capabilities of AD is mostly up to you.
    Start with a tool that is designed to work well with AD like PowerShell. VBScritp is onluy useful to those who are skilled with AD and scripting in VBSdcript.  From your script we can see you are a beginner at both.  As Bill notes...do yourself
    a favor and switch to PowerShell.
    ¯\_(ツ)_/¯

  • How to stop users not in any group and users from other groups accessing sites they have no permission to access on top link bar?

    Hello Community
        Using SharePoint 2010 Server and UI, a web application
    was created with subsites.
        The subsites have unique permissions and Owner, Member
    and Visitor groups.
        The problem is however even if a user does not exist
    in a group that user can access the top link bar/navigation
    bar and its sub sites.
        Also any user in any group can access any top link bar/navigation bar and its subsites.
        How do you enforce that if a user is not in a group
    they are denied access the top link bar/navigation bar and its
    subsites?
        Thank you
        Shabeaut

    If you are using the built in SharePoint navigation links, SharePoint will automatically hide links to sites that a given user doesn't have access to.
    The problem is, it sounds to me like you have a fixed top link bar that lists the content and if a user doesn't have access, the link still shows up.
    You may want to look at how the top link bar was encapsulated in the design of the page.  If it isn't wrapped in the permissions provider code, that could be the problem.
    I trust that answers your question...
    Thanks
    C
    |
    RSS |
    http://crayveon.com/blog |
    SharePoint Scripts | Twitter |
    Google+ | LinkedIn |
    Facebook | Quix Utilities for SharePoint

  • Generate User Member Rules during run time

    We are using organizations to group users of similar job functions. Our users can have many job functions, hence, belonging to multiple organizations. We are using user member rules to populate the list of users. So far, everything�s done manually through IDM�s admin interface. We will be customizing workflows to create these organizations automatically, and need a way to generate the user member rule dynamically upon creation of the organization. Is there anyway to create user member rules dynamically in a workflow and assign to an organization?

    Udo,
    I recently ran into something similar, but from the other direction: I started with some buttons that were handled in an event structure, and I wanted to add a set of matching, redundant commands in the run-time menu that would trigger the same event cases as the buttons.
    This seems like a common situation, and I couldn't help but wonder if I was missing something too.
    In the end, my solution was a two-stage approach where each button and menu event performed a "Value(Signaling)" property node update on a single string control. Then I created an event case for that string control and used the updated value to determine what code to actually run.
    This obviously required some cutting-and-pasting from the original set of event cases, but it seems to work well. Attached is a simple example (LV 7.1.1).
    Regards,
    JohnMessage Edited by Johnner on 04-06-2005 09:21 AM
    Attachments:
    example.zip ‏15 KB

  • Cannot chatting with user in BBM group

    Hi All
    On BBM can I chatting with one member in group without  add to contact list.
    When I select one member in group to chat, it cannot, the msg box "BBM Contact does not exist, Invite to BBM"
    Thanks

    When you create the attestation event, there is an Administrative Group on the drop down as well as Process Owner group on the task itself.
    Have you defined either of these for the user who you want to see the task?
    -Kevin

Maybe you are looking for