Get-PnPSiteSearchQueryResults

Executes a search query to retrieve indexed site collections

Syntax

Get-PnPSiteSearchQueryResults
   [-StartRow <Int>]
                                [-MaxResults <Int>]
                                [-Query <String>]
                                [-Web <WebPipeBind>]
                                [-Connection <SPOnlineConnection>]
Get-PnPSiteSearchQueryResults
   [-All [<SwitchParameter>]]
                                [-Query <String>]
                                [-Web <WebPipeBind>]
                                [-Connection <SPOnlineConnection>]

Examples

------------------EXAMPLE 1------------------

Get-PnPSiteSearchQueryResults

Returns the top 500 site collections indexed by SharePoint Search

------------------EXAMPLE 2------------------

Get-PnPSiteSearchQueryResults -Query "WebTemplate:STS"

Returns the top 500 site collections indexed by SharePoint Search which have are based on the STS (Team Site) template

------------------EXAMPLE 3------------------

Get-PnPSiteSearchQueryResults -Query "WebTemplate:SPSPERS"

Returns the top 500 site collections indexed by SharePoint Search which have are based on the SPSPERS (MySite) template, up to the MaxResult limit

------------------EXAMPLE 4------------------

Get-PnPSiteSearchQueryResults -Query "Title:Intranet*"

Returns the top 500 site collections indexed by SharePoint Search of which the title starts with the word Intranet

------------------EXAMPLE 5------------------

Get-PnPSiteSearchQueryResults -MaxResults 10

Returns the top 10 site collections indexed by SharePoint Search

------------------EXAMPLE 6------------------

Get-PnPSiteSearchQueryResults -All

Returns absolutely all site collections indexed by SharePoint Search

Parameters

-All

Automatically page results until the end to get more than 500 sites. Use with caution!

Type:SwitchParameter
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-Connection

Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection.

Type:SPOnlineConnection
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-MaxResults

Maximum amount of search results to return. Default and max is 500 search results.

Type:Int
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-Query

Search query in Keyword Query Language (KQL) to execute to refine the returned sites. If omitted, all indexed sites will be returned.

Type:String
Position:0
Accept pipeline input:True
Accept wildcard characters:False
-StartRow

Search result item to start returning the results from. Useful for paging. Leave at 0 to return all results.

Type:Int
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-Web

This parameter allows you to optionally apply the cmdlet action to a subweb within the current web. In most situations this parameter is not required and you can connect to the subweb using Connect-PnPOnline instead. Specify the GUID, server relative url (i.e. /sites/team1) or web instance of the web to apply the command to. Omit this parameter to use the current web.

Type:WebPipeBind
Position:Named
Accept pipeline input:False
Accept wildcard characters:False

Outputs

List<System.Object>