I'm writing a PowerShell script that adds users to a SharePoint site. To check if the user exists I'm calling the EnsureUser. But my issue is that the when calling this method with a ldap membership provider(Microsoft.Office.Server.Security.LdapMembershipProvider) (i:0#.f|ldapmembership|username) it always returns a user even the user do not exists in Active Directory. So I'm able to add uses that do not exists.

  • Are you using AD Groups? – Hugh Wood Nov 29 '12 at 11:07
  • Yes we are using the LdapRoleProvider for groups, but this script is adding users. – gaotter Nov 29 '12 at 11:32
  • Are you checking the user like this? SPWeb.EnsureUser(i:0#.f|ad_membership|user) (A code sample from you might help in this case) – Hugh Wood Nov 29 '12 at 11:42
  • Yes. $web = Get-SpWeb <url>;$user = $web.EnsureUser(i:0#.f|ldapmembership|username); #No exception even user does not exists i source. – gaotter Nov 30 '12 at 9:05
  • Are the AD groups nested at all? Nested groups can't be read for permissions by all functions. – Hugh Wood Nov 30 '12 at 9:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.