The query I ran using SharePoint Search Center returned about 430 results. Should I be expecting something different from this script? I copied it verbatim from the link above:
param (
[string]$searchString = "$(Read-Host 'Enter a search string:')",
[Int]$searchRowLimit = "$(Read-Host 'Row Limit (0 for unlimited):')",
[string]$searchResults = "$(Read-Host 'Path for results(CSV):')"
)
$snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}
if ($snapin -eq $null)
{
Write-Host "Loading SharePoint Powershell Snapin`r`n"
Add-PSSnapin "Microsoft.SharePoint.Powershell"
}
$proxy = Get-SPEnterpriseSearchServiceApplicationProxy -Identity "Search Service Application"
$query = New-Object Microsoft.office.Server.Search.Query.KeywordQuery $proxy
$query.ResultTypes = [Microsoft.Office.Server.Search.Query.ResultType]::RelevantResults
$query.RowLimit = $searchRowLimit
$query.QueryText = $searchString
$resultTableColl = $query.Execute()
$resultTable = $resultTableColl.Item([Microsoft.Office.Server.Search.Query.ResultType]::RelevantResults)
$resDataTable = $resultTable.Table
$resDataTable.Rows | Select-Object -Property Path,Title | Export-Csv -Path $searchResults -Encoding unicode
I'm really hoping it's just something I'm overlooking; I really need this script to work.
Would my environment have anything to do with it? I'm using SP13 Server on-prem; the author of the post seemed to think it would work in SP13 though.
-
Edited by
E. Owen
Thursday, January 08, 2015 5:29 PM