Activate Global Search for Modern Site

The Modern SharePoint by default only allows you to search inside that specific site. However, the new version of SharePoint PNP PowerShell allows you to activate the Search for all SharePoint instead of just that specific site.

Update the PNP PowerShell for the latest version.

Update-Module SharePointPnPPowerShell*
Connect-PnPOnline -Url "" -UseWebLogin
 $web = Get-PnPWeb
 #1 to activate Global Search and 0 to deactivate Global Search
 $web.SearchScope = 1 
 Write-Host "Done" -BackgroundColor Green	
 Write-Host "No permission" -BackgroundColor Red	
Write-Host "All Done"
Write-Host "Press any key to Close..."


The Modern Site where you run this script will now search on all SharePoint Sites. To make the search to go on original behavior on SearchScope switch the value for 0.

One Comment

  1. Dal Thiara said:

    Hi David

    Thank you for this PnP Powershell script. Its been most helpful.

    I am new to scripting and still trying to learn it. there does not seem to a lot of material on scripting. Do you know of any site/link where I could learn more?

    Kind Regards

    February 9, 2021

Leave a Reply

Your email address will not be published. Required fields are marked *