4

I want to set Type="People Search Results" and in Credential Information want to set default authentication using PowerShell. I have used below code to create result source but I am not able to set Type and credential information property using PowerShell.

# create manager instances
$fedManager = New-Object Microsoft.Office.Server.Search.Administration.Query.FederationManager($sspApp)
$searchOwner =  Get-SPEnterpriseSearchOwner -Level Ssa 

# define query

$queryProperties = New-Object Microsoft.Office.Server.Search.Query.Rules.QueryTransformProperties

# define custom sorting
$sortCollection = New-Object Microsoft.Office.Server.Search.Query.SortCollection
$sortCollection.Add("Title", [Microsoft.Office.Server.Search.Query.SortDirection]::Ascending)
$queryProperties["SortList"] = [Microsoft.Office.Server.Search.Query.SortCollection]$sortCollection

# create result source
$resultSource = $fedManager.GetSourceByName($name,$searchOwner)
Write-Host $resultSources.ResultSource.ToString()
Write-Host $resultSource
if($resultSource)
{
        Write-Host "Result Source : $name already exist. Deleting..."
        $fedManager.RemoveSource($resultSource)
}
Write-Host "Result Source : $name Creating..."
$resultSource = $fedManager.CreateSource($searchOwner)
$resultSource.Name = $name

$resultSource.ProviderId = $fedManager.ListProviders()[$protocol].Id
$resultSource.CreateQueryTransform($queryProperties, $queryTransform)
$resultSource.Commit()

enter image description here

enter image description here

2 Answers 2

2
1

If you would want to set Type="People Search Results", then I recommend you update your code with below. I have created this way.

$resultSource.ProviderId = $fedManager.ListProviders()['Local People Provider'].Id

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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