1

I want to remove any azure/msonline/sharepoint modules from powershell. However I'm unable to remove the PnP module for SharePoint Online

Powershell> Uninstall-Module -Name SharePointPnPPowerShellOnline PackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'SharePointPnPPowerShellOnline'. At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2194 char:21 + ... $null = PackageManagement\Uninstall-Package @PSBoundParameters + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], Exception + FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage

The module is located at:

C:\Users\USER\AppData\Local\Apps\SharePointPnPPowerShellOnline\Modules\SharePointPnPPowerShellOnline\SharePointPnPPowerShellOnline.psd1

Not sure what Im missing but perhaps someone can enlighten me. Thank you in advanced.

4
  • Can you try to run 'Get-Module SharePointPnPPowershell* -ListAvailable' on powershell and share output? It seems it might be already uninstalled... Jul 17, 2019 at 16:55
  • Powershell> Get-Module SharePointPnPPowershell* -ListAvailable Directory: C:\Users\jescobar\AppData\Local\Apps\SharePointPnPPowerShellOnline\Modules ModuleType Version Name ExportedCommands ---------- ------- ---- ---------------- Binary 3.10.19... SharePointPnPPowerShellOnline {Add-PnPAlert, Add-PnPApp, Add-PnPClientSidePage, Add-PnPClien...
    – jes516
    Jul 24, 2019 at 15:19
  • It still shows. Im unable to install any module also. Im starting to think there is something corrupt with PowerShell. I tried to install AzureAD module and it goes through the installation motions, but when i try to load module, it tells me it does not exist.
    – jes516
    Jul 24, 2019 at 15:20
  • this is most likley an issue with not trusting the PSRepository. I've done in the past is to delete the entry Uninstall-PSRepository -Name PSGallery ... Register-SPRepository -Default ... Further, i've seen cases where updating PowerShellGet.
    – Roman
    Dec 14, 2020 at 0:46

3 Answers 3

1

Ran into the same issue a few days ago.

What worked for me was deleting the entire "SharePointPnPPowerShellOnline" folder and then installing the module again using

Install-Module SharePointPnPPowerShellOnline
1

I've been troubleshooting this issue for a couple of days now, so I'll post my solution here even though this is an old question (2nd result in my Google search for the error message). Hopefully, this can help someone in the same situation...

No matter how many times I tried Uninstall-Module SharePointPnPPowerShellOnline, it always came up as not installed.

Searching the standard location for PS modules also didn't help because there was no SharePointPnPPowerShellOnline folder.

I then found the bugger in C:\Users\<myuser>\OneDrive - <mycompany>\Documents\WindowsPowerShell\Modules\SharePointPnPPowerShellOnline. It turns out OneDrive was syncing this legacy module from an old install.

After deleting the above folder I was finally able to Install-Module -Name "PnP.PowerShell".

0

Here's what worked for me:

Get-Module SharePointPnPPowerShellOnline -ListAvailable | Select-Object Name,Version,Path

Note the path option at the end of the command. With the path, I was able to delete the SharePointPnPPowerShellOnline folder.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.