Create Communication Sites
A PowerShell with SharePoint tutorial
In
earlier articles, we have been working with SharePoint app
creation and removal, but now we will go over to sites.
We will start with modern SharePoint communication sites.
In the demo below, Peter Kalmström uses an array with department
names that he created from an Excel list in an
earlier demo. He wants to give each of the departments
a new site collection, and here he writes a forEach loop
that creates one root site for each department.
The URL for each communication site will end with the department
name, and Peter also lets the forEach create progress messages
during the site generation.
Peter uses the cmdlet, New-PnPSite for the site creation
and the site type is hardcoded to CommunicationSite.
foreach($Dep in $Departments){
$SiteURL = "PATH/" + $Dep
Write-Host ($SiteURL + "
is being created ...") -ForegroundColor Yellow
New-PnPSite -Type CommunicationSite -Title $Dep -Url $SiteURL
}
Peter adds subsites to the HQ site collection in a
later article.
In
the
next demo, Peter shows how to remove all the communication
sites again.
|