• Brad Beran

Apply a SharePoint Site Design to Every Site in a Hub

As time passes your company’s needs of sites will change as well. Whether it is a new site column, changing guest access, adding permissions, or creating a list/library a site design can be a great way achieving this for a single site but what about for an entire hub? If you have tried the Site design applied to associated sites in the Hub Site Settings, you probably noticed that it only applies the site design to newly associated sites. That is where PnP comes in.


Step 1: Get the Site Design ID

To use the Invoke-PnPSiteDesign action we need to grab the ID of the site design we would like to use. You will need to connect to your admin center and then run Get-PnPSiteDesign to list all of your tenant’s site designs. Copy the Id of the site design you would like to use.

Connect-PnPOnline -Url https://yourtenant-admin.sharepoint.com
Get-PnPSiteDesign  

Step 2: Fill in the Variables and Run the Script

Now that we have the Id, copy the code below and fill in the values for $AdminURL, $HubSite, and $SiteDesignID. The script will now run through every associated site within the hub and apply the site design.

####################### Variables #########################
$AdminURL= "https://yourtenant-admin.sharepoint.com"
$HubSite= "https://yourtenant.sharepoint.com/sites/HRHub"
$SiteDesignID = "d5d90025-0902-492a-8ead-2fcb655a6cd2"
###########################################################
 
#Connect to the SharePoint Admin site
Connect-PnPOnline -Url $AdminURL
 
#Get associated sites to the hub
$sites = Get-PnPHubSiteChild -Identity $HubSite
 
##Apply site design to associated sites
foreach ($currentsite in $sites) {
 $currentsite
 Invoke-PnPSiteDesign -Identity $SiteDesignID -WebUrl $currentsite
}
 
##Apply site design to top hub site
Invoke-PnPSiteDesign -Identity $SiteDesignID -WebUrl $HubSite 

If you have any questions or need help implementing this for your organization, please contact us!


5 views0 comments

© 2020 by APSIDIEN LLC

  • LinkedIn

Milwaukee | Madison | Appleton | Wisconsin | Minneapolis | Minnesota | United States