Set-PnPSearchSettings

Tip

We encourage you to make improvements to this documentation. Please navigate to https://github.com/pnp/powershell/blob/dev/documentation/Set-PnPSearchSettings.md to change this file.

Sets search settings for a site

Syntax

Set-PnPSearchSettings
   [-SearchBoxInNavBar <SearchBoxInNavBarType>]
   [-SearchPageUrl <String>]
   [-SearchBoxPlaceholderText <String>]
   [-SearchScope <SearchScopeType>]
   [-Scope <SearchSettingsScope>]
   [-Force]
   [-Connection <PnPConnection>]
   [<CommonParameters>]

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
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Force

Do not ask for confirmation.

Type:SwitchParameter
Position:Named
Default value:None
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
Accepted values:Site, Web
Position:Named
Default value:None
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
Accepted values:Inherit, AllPages, ModernOnly, Hidden
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-SearchBoxPlaceholderText

{{ Fill SearchBoxPlaceholderText Description }}

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-SearchPageUrl

Set the URL where the search box should redirect to.

Type:String
Position:Named
Default value:None
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
Accepted values:DefaultScope, Tenant, Hub, Site
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False