We have the following script that was running on sharepoint 2010 where we had clasic windows authentication.
When we moved to SP 2013, the authentication was changed to Claims.
The following code doesnt work anymore on Sp 2013
$spsite = new-object Microsoft.SharePoint.SPSite("https://mysite.com/");
$web = $spsite.openweb("/subsite1/subsite2/")
$removeUser = $web.AllUsers["domainname\username"];
I have to add the claims thing to make it work
$spsite = new-object Microsoft.SharePoint.SPSite("https://mysite.com/");
$web = $spsite.openweb("/subsite1/subsite2/")
$removeUser = $web.AllUsers["i:0#.w|domainname\username"];
How can I change this to make it work without the claim thingy!
SiteUsers
collection rather than theAllUsers
collection depending on the requirements.SiteUsers
has the largest set of principals.