Set-PnPSearchSettings

Sets search settings for a site

Syntax

Set-PnPSearchSettings
   [-SearchBoxInNavBar <SearchBoxInNavBarType>]
                        [-SearchPageUrl <String>]
                        [-SearchScope <SearchScopeType>]
                        [-Scope <SearchSettingsScope>]
                        [-Force [<SwitchParameter>]]
                        [-Web <WebPipeBind>]
                        [-Connection <PnPConnection>]

Examples

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

Set-PnPSearchSettings -SearchBoxInNavBar Hidden -Scope Site

Hide the suite bar search box on all pages and sites in the site collection

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

Set-PnPSearchSettings -SearchBoxInNavBar Hidden -Scope Web

Hide the suite bar search box on all pages in the current site

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

Set-PnPSearchSettings -SearchPageUrl "https://contoso.sharepoint.com/sites/mysearch/SitePages/search.aspx"

Redirect the suite bar search box in the site to a custom URL

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

Set-PnPSearchSettings -SearchPageUrl ""

Clear the suite bar search box URL and revert to the default behavior

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

Set-PnPSearchSettings -SearchPageUrl "https://contoso.sharepoint.com/sites/mysearch/SitePages/search.aspx" -Scope Site

Redirect classic search to a custom URL

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

Set-PnPSearchSettings -SearchScope Tenant

Set default behavior of the suite bar search box to show tenant wide results instead of site or hub scoped results

------------------EXAMPLE 7------------------

Set-PnPSearchSettings -SearchScope Hub

Set default behavior of the suite bar search box to show hub results instead of site results on an associated hub site

Parameters

-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:PnPConnection
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-Force

Do not ask for confirmation.

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

Scope to apply the setting to. Possible values: Web (default), Site\r\n\r\nFor a root site, the scope does not matter.

Type:SearchSettingsScope
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-SearchBoxInNavBar

Set the scope of which the suite bar search box shows. Possible values: Inherit, AllPages, ModernOnly, Hidden

Type:SearchBoxInNavBarType
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-SearchPageUrl

Set the URL where the search box should redirect to.

Type:String
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-SearchScope

Set the search scope of the suite bar search box. Possible values: DefaultScope, Tenant, Hub, Site

Type:SearchScopeType
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