Home >Tips >PowerShell with SharePoint from Scratch >Create intranet - progress messages kalmstrom.com site map icon Site map  

Create a SharePoint Intranet

Progress Messages

A PowerShell with SharePoint tutorial

PowerShell icon
As a last part in our series PowerShell with SharePoint from Scratch, we offer some articles and demos where Peter Kalmström explains how to create an intranet with subsites for three departments in a small company. The department names are added to a Departments array, which is the basis for most of the code.

The root site is a HQ site that we created in an earlier article. In the articles before this one, we have created Communication subsites, one for each department, we have added a common navigation for all sites and also a link to an external link. Moreover, we have given the three subsites modern apps for photos and tasks and pages for progress, problems and plans.

PowerShell progress messages

In the demo below, Peter does not create anything more for the subsites. Instead, he adds code for Progress messages in parts of the code.

foreach($Dep in $Departments){
    #Create the subsite
    Write-Host ("Creating sub site " + $Dep + " ...") -ForegroundColor Yellow
    New-PnPWeb -Title $Dep -Url $Dep -InheritNavigation -Template SITEPAGEPUBLISHING#0
    #Add navigation node to the top site
    Add-PnPNavigationNode -Location QuickLaunch -Title $Dep -Url ($URL + "/" + $Dep)
    Write-Host ("Done with site " + $Dep + " ...") -ForegroundColor Green

PowerShell with SharePoint from Scratch cover Peter uses the Write-Host cmdlet and adds text color in addition to the actual message. He uses yellow for ongoing creation, red for ongoing removal and green for success.

You will find more detailed explanations in the book.

Download the script that Peter uses in the demo

In the next article, we will add themes to the subsites

Follow kalmstrom.com on LinkedIn Facebook or Twitter!

back icon next icon
Products Buy FAQ Services Tips Books Contact About Us Tools

Security and integrity

Copyright  Kalmstrom Enterprises AB  All rights reserved