[toc]
I love using the pipeline in PowerShell. Recently I was in a situation where, if a PS script what a one-liner I didn’t have to submit it through the review/approval/change management process. Its amazing what you can do in PowerShell in a single line of code!
Retrieve all site collections, for all web applications in the current farm.
$oSites = Get-SPWebApplication | Get-SPSite -Limit All
That one is pretty simple and I’m sure you’ve done it a bazillion times. Lets add a little more and return all site collections, for all web applications except personal sites!
$oSites = Get-SPWebApplication | Get-SPSite -Limit All | where {($_.RootWeb.WebTemplateId -ne 54) -and ($_.RootWeb.WebTemplateId -ne 21)}
The only thing I’ve added here is a where clause that excludes sites with a template ID of 54 (personal site host) and 21 (personal sites).
Odd this isn’t working for me. It’s grabbing all the sites but still including MySites. I even added an exclusion for 22 and it’s picking them up, really… really… slowly…
Hi Jim,
Have you taken a look to see what the root web template it for the MySites site collection?