Forum Discussion
PnP PowerShell modules
- Dec 14, 2016
Hi Dean_Gross,
it looks like you've got two versions installed.
you might want to try the following:
$modules = get-module -ListAvailable | where {$_.Name -eq "SharePointPnPPowerShellOnline"} foreach($module in $modules) { Write-Host $module.Name $module.Path }This should give you the location of the modules.
I had a spring clean today of my PnpCommandlets as I want to ensure I stick to the new syntax Anyway I uninstalled each of the older versions and then I ran the update-module. Doh! I now have 2 versions installed. Ok, I will try remove the older one so do this the interactive way.
uninstall-module SharePointPnPPowerShellOnline -AllVersions -Confirm
Confirm
Are you sure you want to perform this action?
Performing the operation "Uninstall-Module" on target "Version '2.11.1701.1' of module
'SharePointPnPPowerShellOnline'".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y
WARNING: The version '2.11.1701.1' of module 'SharePointPnPPowerShellOnline' is currently in use. Retry the operation
after closing the applications.
PackageManagement\Uninstall-Package : Module 'SharePointPnPPowerShellOnline' is in currently in use.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2157 char:21
+ ... $null = PackageManagement\Uninstall-Package @PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Packag
e], Exception
+ FullyQualifiedErrorId : ModuleIsInUse,Uninstall-Package,Microsoft.PowerShell.PackageManagement.Cmdlets.Uninstall
Package
This confuses me as I am not running any PnpCommandlets .. Do I need to remove-module before uninstalling it?
Daniel Westerdale, it looks like that version has been installed with an installer.
You're getting the error becsause the modules have been loaded wihtin a PowerShell session. You could try closing all PowerShell session. ( Check Task Manager for anything PowerShell like)
Then I would try and deinstall using the installer ( Add/remove programs)
- Daniel WesterdaleMar 01, 2017Iron Contributor
Yes you were spot on .. even though I had closed ISE it was still present in the Task Manager. I ran a Cmder PS Console window for a change and it the above command has removed all SharePointPnPPowerShellOnline modules which suprised me as I thought I would be prompted for the one I wanted to keep. I installed the latest and greatest .. Thanks for you help