Skip to content

Instantly share code, notes, and snippets.

@jamiechalmerzlp
Last active October 20, 2022 20:47
Show Gist options
  • Save jamiechalmerzlp/65ad97c39e971d18134282102f7d7e65 to your computer and use it in GitHub Desktop.
Save jamiechalmerzlp/65ad97c39e971d18134282102f7d7e65 to your computer and use it in GitHub Desktop.
Provides the ability to set an admin to every site in your SharePoint list.
Connect-PnPOnline -Url *sharepointadminurl* -Interactive
$Sites = Get-PnPTenantSite
for($x = 0; $x -lt $Sites.Count; $x++) {
Set-PnPTenantSite -Url $Sites[$x].Url -Owners "*adminemailaddress*"
Write-Host "Updating $($Sites[$x].Title), Site $($x)"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment