Last Updated on December 24, 2022 by Mathew Diekhake
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.
cult_hero13
July 9, 2022 @ 15:55
I can’t get my custom Powershell module to import in Azure Function. I use the Azure Function app that can run some Powershell commands, and I tried to import a custom Powershell module I wrote. I know that it works because I tested it. The problem is only related to when I try to import it. When I try, it gives me the following error:
ERROR: Failed to generate proxies for remote module ‘AzureCon’. The -OutputModule parameter does not resolve to a path, and a user module path cannot be found for the provided name.
As mentioned, I had tested this already, so not sure why it begins having the problem only when going to import. Any ideas?
Mat Diekhake
July 9, 2022 @ 15:57
That error may not be due to a PowerShell code issue but rather an environment setting variable that is not checked. Ensure the
PSModulePath
variable is checked.