· 2 min read
Start crawling with PowerShell
For our first ‘big’ project for SharePoint 2010 we started with some automated roll-out, using PowerShell. So whenever we do a build we can easily deploy ‘everything’ that is in our features, and since we deploy some content trough features we needed to update the search.
Instead of updating it through code we used PowerShell to start crawling the content we just deployed. That way you can keep from creating featurereceivers doing your deployment stuff, seems to be quite easy actually to do things with PowerShell; all you need is some time finding the things you need.
Like you can see on the SharePoint 2010 Search Wiki there are quite some cmdLets available, digging in them a bit more you can retrieve almost all information you need with: Get-SPIisWebServiceApplicationPool The fact that you can combine that with other calls you can even get more with cmdlets like Get-SPEnterpriseSearchCrawlContentSource Combining those allowing you to get your contentsource, that you can use to start crawling it:
$CrawlContent = Get-SPEnterpriseSearchServiceApplication| Get-SPEnterpriseSearchCrawlContentSource
Check all members of your $CrawlContent with a $CrawlContent | Gm to check what you can do with it. I used the $CrawlContent.CrawlStatus to check whether i should crawl or not
if ( $CrawlContent.CrawlStatus -eq "Idle" ) {
$CrawlContent.StartIncrementalCrawl()
}
So finaly you end op with something like :
$CrawlContent = Get-SPEnterpriseSearchServiceApplication| Get-SPEnterpriseSearchCrawlContentSource
if ( $CrawlContent.CrawlStatus -eq "Idle" ) {
$CrawlContent.StartIncrementalCrawl()
}
$CrawlContent.CrawlStatus

Albert-Jan Schot
CTO, Microsoft MVP & FastTrack Recognized Solution Architect
I am Albert-Jan Schot, CTO at Blis Digital, Microsoft MVP, and FastTrack Recognized Solution Architect focused on Microsoft 365, Azure, and AI agents. I help teams turn complex Microsoft Cloud challenges into practical architecture decisions and shipped outcomes.
Zuid Holland, Netherlands


