Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

How can I find out all the sites where the user is a primary site collection administrator or a secondary site collection administrator.

We have around 200+ site collections and growing and hence looking to avoid a loop. For membership we are currently using "contentclass:sts_site" with SearchServiceApplicationProxy.

I guess I should have added more details to the above - Since I already have the code for the Search Application Proxy utilizing the object model, preferably I was looking towards a solution where I could still utilize Search Application Proxy to fetch all details in one go.

share|improve this question

migrated from stackoverflow.com Nov 28 '11 at 18:47

This question came from our site for professional and enthusiast programmers.

add comment

2 Answers 2

This should do what you you want

$user = "domian\username"
Get-SPSite | Where {$_.Owner.UserLogin -eq $user -or $_.SecondaryContact.UserLogin -eq $user}
share|improve this answer
    
That's exactly what I was getting at, except my PoSH sucks :P –  James Love Nov 28 '11 at 20:50
add comment

I don't have a box handy to give you exact code, but you could use powershell to get all SPSites within a web application, and filter by a given username (Owner is the property you want from each SPSite object).

share|improve this answer
    
The owner is a single user value right? And the owner is automatically assumed to be a site collection administrator. If I'm not mistaken, you can load up more site collection administrators, who won't show up as owners. –  David Lozzi Nov 28 '11 at 19:31
    
Yes, the 'owner' is the Primary Site Collection administrator, and there is only one, and this is assigned (normally) via Central Administration. –  James Love Nov 28 '11 at 19:59
    
Ah, i see he's asking for the Primary and Secondary, Owners will work then. ;) –  David Lozzi Nov 28 '11 at 20:20
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.