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

I have been trying to find a cmdlet to do this but I havent been able to. I want to create a content source with a starting url, the problem is that url already exists on the default content source so I want to remove it from there. But I want to do it with powershell, any help is appreciated.

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

I would do it like this:

$searchServiceName = "Your Search Service Application"
$addressToMove = "http://your/start/address"
$defaultContentSourceName = "Local SharePoint sites"

$searchService = Get-SPEnterpriseSearchServiceApplication -Identity $searchServiceName

$defaultContentSource = Get-SPEnterpriseSearchCrawlContentSource -Identity $defaultContentSourceName -SearchApplication $searchService

if ($defaultContentSource.StartAddresses.Exists($addressToMove))
{
    $defaultContentSource.StartAddresses.Remove($addressToMove)
}

$defaultContentSource.Update()

# then you can add $addressToMove to another content source

And I know this works, it is used as part of a deployment package for an application I'm working on, and has been tested and successfully deployed across several environments.

[Note: we use SharePoint Server 2010 / SharePoint Server Search, not Foundation or FAST, so I'm not sure how it would work in those cases, if that is your environment.]

share|improve this answer
add comment

You can achieve this using the next powershell snippet:

$sourceName = "File"

$contentSSA = "FASTContent"

$source = Get-SPEnterpriseSearchCrawlContentSource -Identity $sourceName -SearchApplication $contentSSA

$startaddresses = $source.StartAddresses | ForEach-Object { $_.OriginalString }

$source.StartAddresses.Clear()

ForEach ($address in $startaddresses ){ $source.StartAddresses.Add($address) }

Reference: http://techmikael.blogspot.co.il/2011/06/clearing-items-from-specific-content.html

I tried it and it works.

share|improve this answer
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.