SharePoint Online – How to hide default themes using PowerShell

Hi All,

Greetings!

Today small article – sharing PowerShell to hide default themes using PowerShell.

Usecase:

  • My organization have created custom theme for all our SharePoint sites.
  • We want to use only my organization custom theme for all the SharePoint sites
  • We do not want the user to override our custom theme with OOB default themes available
  • Here is the requirement born – hide the default OOB themes from SharePoint Online sites.
A screenshot of the SharePoint theme selection interface, highlighting the organization's custom theme options in red and the default Microsoft themes in orange.
image 1: SharePoint online >> Default Site Themes

Solution

  • We have a PowerShell CMDLET – Set-SPOHideDefaultThemes available to hide the default themes
Set-SPOHideDefaultThemes
    [-HideDefaultThemes] <Boolean>
    [<CommonParameters>]

Example:

import-Module C:\Users\prasham\Documents\PowerShell\Modules\Microsoft.Online.SharePoint.PowerShell -UseWindowsPowerShell

Connect-SPOService -Url https://knowledgejunction1-admin.sharepoint.com/

Set-SPOHideDefaultThemes -HideDefaultThemes $true

Screenshot of PowerShell window showing commands to connect to SharePoint Online and warnings related to module imports.
image 2: SharePoint online >> Site Themes – executing PS for hiding OOB Site Themes – Set-SPOHideDefaultThemes

  • As we executes the CMDLET – Set-SPOHideDefaultThemes successfully, default / OOB themes are get hidden as shown in image below.
Theme selection interface displaying current selected theme and organizational themes in SharePoint.
image 3: SharePoint online >> Site Themes after executing the CMDLET to hide the OOB themes

References

Prasham Sabadra

LIFE IS VERY BEAUTIFUL. ENJOY THE WHOLE JOURNEY :) Founder of Microsoft 365 Junction, Speaker, Author, Learner, Developer, Passionate Techie. Certified Professional Workshop Facilitator / Public Speaker. Believe in knowledge sharing. Around 20+ years of total IT experience and 17+ years of experience in SharePoint and Microsoft 365 services Please feel free me to contact for any SharePoint / Microsoft 365 queries. I am also very much interested in behavioral (life changing) sessions like motivational speeches, Success, Goal Setting, About Life, How to live Life etc. My book - Microsoft 365 Power Shell hand book for Administrators and Beginners and 100 Power Shell Interview Questions - https://www.amazon.in/Microsoft-Administrators-Beginners-Interview-Questions/dp/9394901639/ref=tmm_pap_swatch_0?_encoding=UTF8&qid=1679029081&sr=8-11

You may also like...

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from Microsoft 365

Subscribe now to keep reading and get access to the full archive.

Continue reading