PowerShell to Create a File

Requirement: Create a file in PowerShell. How to create a new file in PowerShell? PowerShell is a powerful scripting language that allows you to automate and manage various tasks on Windows and other systems. One of the common tasks that you may have to perform using PowerShell is creating a file. In…

Read more

SharePoint Online: How to Inject Custom CSS in Modern Sites?

Requirement: Add custom CSS to modern SharePoint Online sites. How to Inject Custom CSS to Modern Sites in SharePoint Online? Customizing the look and feel of a SharePoint Online site can be a great way to make the site more visually appealing and better suited to your needs. One way to do…

Read more

Fix “Connect-SPOService : Could not connect to SharePoint Online.” Error

Problem: When trying to connect to SharePoint Online using the Connect-SPOService cmdlet, I got this error message, “Connect-SPOService : Could not connect to SharePoint Online.” Solutions: 1. Make sure the given tenant admin URL is correct, and your system is able to connect to the Tenant admin site! Just try to open…

Read more

Get-UnifiedGroup : The term ‘Get-UnifiedGroup’ is not recognized as the name of a cmdlet, function, script file, or operable program.

Problem: Getting “Get-UnifiedGroup : The term ‘Get-UnifiedGroup’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.” error in PowerShell! Root Cause and Solution: You must…

Read more

Find All Office 365 Group Memberships of a User using PowerShell

Requirement: Get a list of all Microsoft 365 groups where a particular user is a member (or owner!). How to a Find a Particular User’s All Office 365 Group Memberships? If you need to find all the Office 365 group memberships that a user is a part of, PowerShell is your best…

Read more

How to Add Comments in PowerShell Scripts?

Adding comments in PowerShell scripts is a great way to document your code and make it more readable for others (and yourself) to understand what your script is doing. Comments can be used to explain the purpose of a script, the different parameters available, or to provide additional information about a script’s…

Read more

How to Create a Retention Policy to Preserve Deleted Items in SharePoint Online?

Requirement: Create a retention policy to preserve deleted items in SharePoint Online. How to create a Retention Policy for SharePoint Online? SharePoint Online retains deleted items for 93 days before they get deleted permanently. What if you want to preserve deleted items for more than 93 days? Say, for 10 years as…

Read more