SOLVED

PnP PowerShell modules

%3CLINGO-SUB%20id%3D%22lingo-sub-35386%22%20slang%3D%22en-US%22%3EPnP%20PowerShell%20modules%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-35386%22%20slang%3D%22en-US%22%3E%3CP%3EWhen%20I%26nbsp%3Brun%20get-module%20-ListAvailable%2C%20I%20get%20the%20following%3A%3C%2FP%3E%3CP%3EScript%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%202.10.16...%20SharePointPnPPowerShellOnline%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7BGet-PnPWebTemplates%2C%20Get-PnPTimeZoneId%2C%20Set-PnPTenantSite%2C%20Uninstall-PnPAppInstance...%7D%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3CBR%20%2F%3EBinary%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%202.8.1610.0%20SharePointPnPPowerShellOnline%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7BGet-PnPWebTemplates%2C%20Get-PnPTimeZoneId%2C%20Set-PnPTenantSite%2C%20Uninstall-PnPAppInstance...%7D%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3BI%20think%20i%20did%20something%26nbsp%3Bwrong%2C%20but%20I'm%20not%20sure%20what.%20Can%20anyone%20tell%20me%20why%20I%26nbsp%3Bwould%20have%20one%20module%20that%20is%20a%20Script%20type%20and%26nbsp%3Banother%20that%20is%20Binary%3F%26nbsp%3BI%20think%20that%20I%20should%20only%20have%20one.%20I%20can't%20figure%20out%20how%20to%20remove%20the%20older%20one%20(the%20binary)%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-35386%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EPnP%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-49639%22%20slang%3D%22en-US%22%3ERe%3A%20PnP%20PowerShell%20modules%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-49639%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F2387%22%20target%3D%22_blank%22%3E%40Pieter%20Veenstra%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYes%20you%20were%20spot%20on%20..%20even%20though%20I%20had%20closed%20ISE%20it%20was%20still%20present%20in%20the%20Task%20Manager.%20%26nbsp%3BI%20ran%20a%20Cmder%20PS%20Console%20window%20%26nbsp%3Bfor%20a%20change%20and%20it%20the%20above%20command%20has%20removed%20all%20SharePointPnPPowerShellOnline%20modules%20which%20suprised%20me%20as%20I%20thought%20I%20would%20be%20prompted%20for%20the%20one%20I%20wanted%20to%20keep.%20%26nbsp%3BI%20installed%20the%20latest%20and%20greatest%20..%20Thanks%20for%20you%20help%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-49544%22%20slang%3D%22en-US%22%3ERe%3A%20PnP%20PowerShell%20modules%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-49544%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F5701%22%20target%3D%22_blank%22%3E%40Daniel%20Westerdale%3C%2FA%3E%2C%20it%20looks%20like%20that%20version%20has%20been%20installed%20with%20an%20installer.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou're%20getting%20the%20error%20becsause%20the%20modules%20have%20been%20loaded%20wihtin%20a%20PowerShell%20session.%20You%20could%20try%20closing%20all%20PowerShell%20session.%20(%20Check%20Task%20Manager%20for%20anything%20PowerShell%20like)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThen%20I%20would%20try%20and%20deinstall%20using%20the%20installer%20(%20Add%2Fremove%20programs)%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-49543%22%20slang%3D%22en-US%22%3ERe%3A%20PnP%20PowerShell%20modules%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-49543%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F2387%22%20target%3D%22_blank%22%3E%40Pieter%20Veenstra%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20had%20a%20spring%20clean%20today%20of%20my%20PnpCommandlets%20as%20I%20want%20to%20ensure%20I%20stick%20to%20the%20new%20syntax%20Anyway%20I%20uninstalled%20each%20of%20the%20older%20versions%20and%20then%20I%20%26nbsp%3B%20ran%20the%20update-module.%20Doh!%20I%20now%20have%202%20versions%20installed.%20Ok%2C%20I%20will%20try%20remove%20the%20older%20one%20so%20do%20this%20the%20interactive%20way.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3Euninstall-module%20SharePointPnPPowerShellOnline%20-AllVersions%20-Confirm%0A%0A%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CEM%3EConfirm%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3EAre%20you%20sure%20you%20want%20to%20perform%20this%20action%3F%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3EPerforming%20the%20operation%20%22Uninstall-Module%22%20on%20target%20%22Version%20'2.11.1701.1'%20of%20module%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E'SharePointPnPPowerShellOnline'%22.%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E%5BY%5D%20Yes%20%5BA%5D%20Yes%20to%20All%20%5BN%5D%20No%20%5BL%5D%20No%20to%20All%20%5BS%5D%20Suspend%20%5B%3F%5D%20Help%20(default%20is%20%22Y%22)%3A%20y%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3EWARNING%3A%20The%20version%20'2.11.1701.1'%20of%20module%20'SharePointPnPPowerShellOnline'%20is%20currently%20in%20use.%20Retry%20the%20operation%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3Eafter%20closing%20the%20applications.%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3EPackageManagement%5CUninstall-Package%20%3A%20Module%20'SharePointPnPPowerShellOnline'%20is%20in%20currently%20in%20use.%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3EAt%20C%3A%5CProgram%20Files%5CWindowsPowerShell%5CModules%5CPowerShellGet%5C1.0.0.1%5CPSModule.psm1%3A2157%20char%3A21%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E%2B%20...%20%24null%20%3D%20PackageManagement%5CUninstall-Package%20%40PSBoundParameters%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E%2B%20CategoryInfo%20%3A%20InvalidOperation%3A%20(Microsoft.Power...ninstallPackage%3AUninstallPackage)%20%5BUninstall-Packag%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3Ee%5D%2C%20Exception%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E%2B%20FullyQualifiedErrorId%20%3A%20ModuleIsInUse%2CUninstall-Package%2CMicrosoft.PowerShell.PackageManagement.Cmdlets.Uninstall%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3EPackage%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20confuses%20me%20as%20I%20am%20not%20running%20any%20PnpCommandlets%20..%20Do%20I%20need%20to%20remove-module%20before%20uninstalling%20it%3F%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-41249%22%20slang%3D%22en-US%22%3ERe%3A%20PnP%20PowerShell%20modules%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-41249%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F2387%22%20target%3D%22_blank%22%3E%40Pieter%20Veenstra%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOk%20I%20can%20see%20you%20have%20argumented%20the%20current%20module%20path%20to%20allow%20any%20custom%20modules%20to%20be%20accessed.%20I%20like%20it.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20this%20case%20I%20have%20a%20couple%20of%20versions%20of%20PnPCommandlets%20in%20my%20main%20module%20directory.%20I%20am%20thinking%20intellisense%20will%20still%20pick%20up%20each%20duplicated%20command%20and%20therein%20is%20my%20issue.%20%26nbsp%3BSo%20I%20can%20move%20the%20older%20modules%20from%20this%20dir%20and%20then%20deploy%20your%20approach%20in%20making%20them%20seen%20in%20the%20path.%20Alternativley%20I%20simple%20delete%20them.%20Just%20seems%20a%20a%20bit%20odd%20I%20can'%20uninstall%2Fremove%20a%20version%20of%20a%20module%20or%20move%20it%20out%20of%20the%20path%20with%20a%20simple%20command%20sequence.%20Maybe%20I%20should%20write%20this%26nbsp%3B%3Cimg%20id%3D%22smileyfrustrated%22%20class%3D%22emoticon%20emoticon-smileyfrustrated%22%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Fi%2Fsmilies%2F16x16_smiley-frustrated.png%22%20alt%3D%22Smiley%20Frustrated%22%20title%3D%22Smiley%20Frustrated%22%20%2F%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-41086%22%20slang%3D%22en-US%22%3ERe%3A%20PnP%20PowerShell%20modules%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-41086%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F5701%22%20target%3D%22_blank%22%3E%40Daniel%20Westerdale%3C%2FA%3E%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20quite%20often%20use%20the%20following%20lines%20in%20my%20scripts%20to%20set%20the%20ModulePath%20to%20include%20the%20Modules%20folder%20to%20includee%20my%20custom%20modules.%20You%20could%20probably%20do%20something%20similar%20to%20control%20the%20different%20versions%20of%20modules.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%24path%20%3D%20Split-Path%20-parent%20%24MyInvocation.MyCommand.Definition%0A%0Aif%20(%24env%3APSModulePath%20-notlike%20%22*%24path%5CModules%5C*%22)%0A%7B%0A%22Adding%20%3B%24path%5CModules%20to%20PSModulePath%22%20%7C%20Write-Debug%20%0A%24env%3APSModulePath%20%2B%3D%20%22%3B%24path%5CModules%5C%22%0A%7D%0AWrite-Host%20%24env%3APSModulePath%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-40765%22%20slang%3D%22en-US%22%3ERe%3A%20PnP%20PowerShell%20modules%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-40765%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F2387%22%20target%3D%22_blank%22%3E%40Pieter%20Veenstra%3C%2FA%3E%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1096%22%20target%3D%22_blank%22%3E%40Dean%20Gross%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20doing%20a%20bit%20of%20house%20keeping%20and%20had%20a%20similar%20thoughts.%3C%2FP%3E%3CP%3EI%20had%20previously%20run%20this%20but%20now%20prefer%20your%20script%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3EGet-Module%20-ListAvailable%20-Name%20*SharePoint*%3C%2FPRE%3E%3CP%3EOk%2C%20in%20my%20case%20I%20see%20this%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EModuleType%20Version%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Name%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20ExportedCommands%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3CBR%20%2F%3E----------%20-------%26nbsp%3B%26nbsp%3B%26nbsp%3B%20----%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20----------------%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3CBR%20%2F%3EScript%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%202.11.17...%20SharePointPnPPowerShellOnline%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7BGet-PnPWebTemplates%2C%20...%3CBR%20%2F%3EScript%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%202.9.1611.0%20SharePointPnPPowerShellOnline%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7BGet-PnPWebTemplates%2C%20...%3CBR%20%2F%3EBinary%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%202.6.1608.0%20SharePointPnPPowerShellOnline%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7BGet-PnPWebTemplates%2C%20...%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENow%20I%20want%20either%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E1)%20remove%2F%20uninstall%20%26nbsp%3Ba%20version%20of%20the%20module%26nbsp%3Bbut%20this%20doesn't%20seem%20to%20work%20exactly%20%3A%3C%2FP%3E%3CPRE%3ERemove-Module%20-FullyQualifiedName%20%40%7BModuleName%20%3D%20'SharePointPnPPowerShellOnline'%3B%20ModuleVersion%20%3D%20'2.9.1611.0'%7D%3C%2FPRE%3E%3CP%3EPreviously%20I%20have%20simply%20deleted%20the%20module%20in%20question%20%26nbsp%3Bfrom%20the%20modules%20dir%20but%20there%20must%20be%20a%20more%20elegant%20way%20to%20do%20this%20...%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eor%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E2)%20I%20want%20to%20keep%20all%20versions%20but%20be%20able%20to%20set%20the%20default%20module%20in%20a%20script%20or%20accross%20all%20scripts%20in%20a%20session%3C%2FP%3E%3CP%3E(%20I%20would%20hate%20to%20add%20a%20path%20to%20each%20commmand%20%3Cimg%20id%3D%22smileysad%22%20class%3D%22emoticon%20emoticon-smileysad%22%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Fi%2Fsmilies%2F16x16_smiley-sad.png%22%20alt%3D%22Smiley%20Sad%22%20title%3D%22Smiley%20Sad%22%20%2F%3E)%3C%2FP%3E%3CP%3E.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-35564%22%20slang%3D%22en-US%22%3ERe%3A%20PnP%20PowerShell%20modules%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-35564%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1096%22%20target%3D%22_blank%22%3E%40Dean%20Gross%3C%2FA%3E%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eit%20looks%20like%20you've%20got%20two%20versions%20installed.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eyou%20might%20want%20to%20try%20the%20following%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%24modules%20%3D%20get-module%20-ListAvailable%20%7C%20where%20%7B%24_.Name%20-eq%20%22SharePointPnPPowerShellOnline%22%7D%0Aforeach(%24module%20in%20%24modules)%0A%7B%0A%20%20%20Write-Host%20%24module.Name%20%24module.Path%0A%7D%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20should%20give%20you%20the%20location%20of%20the%20modules.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Respected Contributor

When I run get-module -ListAvailable, I get the following:

Script     2.10.16... SharePointPnPPowerShellOnline       {Get-PnPWebTemplates, Get-PnPTimeZoneId, Set-PnPTenantSite, Uninstall-PnPAppInstance...}                       
Binary     2.8.1610.0 SharePointPnPPowerShellOnline       {Get-PnPWebTemplates, Get-PnPTimeZoneId, Set-PnPTenantSite, Uninstall-PnPAppInstance...}        

 

 I think i did something wrong, but I'm not sure what. Can anyone tell me why I would have one module that is a Script type and another that is Binary? I think that I should only have one. I can't figure out how to remove the older one (the binary)            

7 Replies
Highlighted
Solution

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.

 

 

Highlighted

@Pieter Veenstra @Dean Gross

 

I am doing a bit of house keeping and had a similar thoughts.

I had previously run this but now prefer your script

 

Get-Module -ListAvailable -Name *SharePoint*

Ok, in my case I see this

 

ModuleType Version    Name                                ExportedCommands        
---------- -------    ----                                ----------------        
Script     2.11.17... SharePointPnPPowerShellOnline       {Get-PnPWebTemplates, ...
Script     2.9.1611.0 SharePointPnPPowerShellOnline       {Get-PnPWebTemplates, ...
Binary     2.6.1608.0 SharePointPnPPowerShellOnline       {Get-PnPWebTemplates, ...

 

Now I want either

 

1) remove/ uninstall  a version of the module but this doesn't seem to work exactly :

Remove-Module -FullyQualifiedName @{ModuleName = 'SharePointPnPPowerShellOnline'; ModuleVersion = '2.9.1611.0'}

Previously I have simply deleted the module in question  from the modules dir but there must be a more elegant way to do this ...

 

or

 

2) I want to keep all versions but be able to set the default module in a script or accross all scripts in a session

( I would hate to add a path to each commmand Smiley Sad)

.

Highlighted

Hi @Daniel Westerdale,

 

I quite often use the following lines in my scripts to set the ModulePath to include the Modules folder to includee my custom modules. You could probably do something similar to control the different versions of modules. 

 

 

 

$path = Split-Path -parent $MyInvocation.MyCommand.Definition

if ($env:PSModulePath -notlike "*$path\Modules\*")
{
"Adding ;$path\Modules to PSModulePath" | Write-Debug 
$env:PSModulePath += ";$path\Modules\"
}
Write-Host $env:PSModulePath

 

 

Highlighted

@Pieter Veenstra

 

Ok I can see you have argumented the current module path to allow any custom modules to be accessed. I like it.

 

In this case I have a couple of versions of PnPCommandlets in my main module directory. I am thinking intellisense will still pick up each duplicated command and therein is my issue.  So I can move the older modules from this dir and then deploy your approach in making them seen in the path. Alternativley I simple delete them. Just seems a a bit odd I can' uninstall/remove a version of a module or move it out of the path with a simple command sequence. Maybe I should write this Smiley Frustrated

 

 

 

Highlighted

Hi @Pieter Veenstra 

 

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? 

 

 

Highlighted

@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)

Highlighted

@Pieter Veenstra

 

 

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