Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
SharPeoint 2013 Search Using Powershell Script
WhatsApp
Devarajan Sm
Jan 26
2016
1.3
k
0
1
param(
[
string
] $searchString =
"$(Read-Host 'Enter a search string:')"
, [
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 = New - Object Mocrosoft.SharePoint.SPSite
"http://XXXXXX.xxxx.ccc"
$query = New - Object Microsoft.office.Server.Search.Query.KeywordQuery $proxy
$query.SourceId =
"xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
$query.ResultTypes = [Microsoft.Office.Server.Search.Query.ResultType]::RelevantResults
$query.RowLimit = 99999
$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
Sharepoint 2013
powershell
SharPeoint 2013 Search
Up Next
SharPeoint 2013 Search Using Powershell Script