You can uninstall a PowerShell module by using the Uninstall-Module cmdlet (command) in Windows PowerShell. For instance, the Uninstall-Module -Name Microsoft.Online.SharePoint.PowerShell command would successfully remove the Sharepoint Online Powershell module.

The following tutorial demonstrates how to uninstall a PowerShell module (that has been previously installed) in Windows PowerShell.

Method One: How to Uninstall Powershell Module

You can uninstall PowerShell modules using the Uninstall-Module command in the PowerShell window. Here is how to do that:

1. Open the elevated Windows Terminal app and select the PowerShell shell from the menu. See this tutorial to learn how to open the elevated version of the Windows Terminal app: How to Open Elevated Windows Terminal as Administrator in Windows 11 [Tutorial].

2. Type the following command into the command line and then press the Enter key on your keyboard to execute it:

Uninstall-Module Module AzureAD

Method Two: How to Use Pipeline to Uninstall Module

You can also use the pipeline to uninstall a module. Here is how to do that:

1. Open the elevated Windows Terminal app and select the PowerShell shell from the menu. See this tutorial to learn how to open the elevated version of the Windows Terminal app: How to Open Elevated Windows Terminal as Administrator in Windows 11 [Tutorial].

2. Type the following command into the command line and then press the Enter key on your keyboard to execute it:

Get-InstalledModule Install-module AzureADPreview Uninstall-Module

In conclusion, that is how to uninstall a PowerShell module.