c# - Search for a Local user in a local group that does not have Foreign Security policy -


Actually I got a post whose problem is in our application and the solution was:

 < Code> Private Static Zero List Group Group (String Group Distilled Name, Principal Contact CTX, Listed> UserPrinitle> Users) {DirectoryEntry Group = New DirectoryInterity ("LDAP: //" + Group Defined Named); Foreign currency (group DN properties in the group ["member"]) {DirectoryEntry gpMemberEntry = New directoryInterity ("LDAP: //" + DN); System.DirectoryServices.PropertyCollection userProps = gpMemberEntry.Properties; Object [] objCls = (User post ["Object class"]. Value) [] in the form of object; If (objCls.Contains ("group")) list group member (userProp ["specific name"]. Value as string, ctx, user); If (! ObjCls.Contains ("Foreign Protector")) {User Principal U = UserPrintal. FidbyIndt (CTX, Identity Type, Distilled Names, DN); If (u! = Null) // u == user blank for any other type except users Add (U); }}}   

However, I am trying to find a local group so that I can change the directory entry:

  DirectoryEntry groupEntry = New DirectoryEntry (string format ("WinNT: // {0} / {1}, group", environment. Machiname, groupname));   

Then it does not work and it says that the property does not exist. How can I do the top, but for the local group and the user?

Actually I'm finished to fix it:

  Protected Bull ISUser InlineLock Group (String UserName, String Group) {using directory directory (new directory directory ("WinNT: // {0}, computer". Format (EnvironmentalMachineName)) (DirectoryEntry groupEntry = computerEntry .Children.Find (Group, "Group")) {foreach (using the IEnumerable groupEntry.Invoke ("member") in Object O (DirectoryEntry entry = no E-DirectoryInterry (O)) {if entry.SchemaClassName.Equals ("User", String Comforine, Ordinal Ignore Cass) and Entry.Engloss (Username, String Compiler, Ordinal Ignore Case)) Returns Correct;}}} Details Is false;}}    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -