Skip to content

Instantly share code, notes, and snippets.

@mirontoli
Last active June 26, 2020 13:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mirontoli/ac7b88df9a28ff4f2e12ad2e56a79f1c to your computer and use it in GitHub Desktop.
Save mirontoli/ac7b88df9a28ff4f2e12ad2e56a79f1c to your computer and use it in GitHub Desktop.
$tenant = "takana17"
Connect-PnPOnline https://$tenant.sharepoint.com/ -SPOManagementShell -ClearTokenCache
$realm = Get-PnPAuthenticationRealm
$loginName = "c:0-.f|rolemanager|spo-grid-all-users/$realm"
$group = Get-PnPGroup -AssociatedVisitorGroup
Add-PnPUserToGroup -LoginName $loginName -Identity $group
# Sets up a SharePoint Home Site at Skanska
$tenant = "takana17"
Connect-SPOService https://$tenant-admin.sharepoint.com
$baseUrl = "https://$tenant.sharepoint.com"
# site swap takes 1-2 minutes. be patient
# https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/invoke-spositeswap?view=sharepoint-ps
Invoke-SPOSiteSwap -SourceUrl "$baseUrl/sites/futurehomesite" -TargetUrl "$baseUrl" -ArchiveUrl "$baseUrl/sites/oldroot-deleteit"
# Home Site. Docs: https://aka.ms/homesites, it make take some time
Set-SPOHomeSite -HomeSiteUrl $baseUrl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment