Repository navigation
Powershell 7 Get-InstalledModule not working #684
Description
Activity
Thanks for letting us know of this issue Andres Bohren (@BohrenAn)! Are you encountering this issue with
Get-PSResourcein PowerShellGet 3.0.17-beta17? We're currently only adding security bug fixes to PowerShellGet v2, but will address any v2 issues or bugs in v3.alerickson
I did run the following command. No return value. Does this help?PS C:\Users\a.bohren> Get-PSResource -Name MicrosoftTeams
PS C:\Users\a.bohren> Get-ModuleModuleType Version PreRelease Name ExportedCommands
Manifest 7.0.0.0 Microsoft.PowerShell.Management {Add-Content, Clear-Content, Clear-Item, Clear-It…
Manifest 7.0.0.0 Microsoft.PowerShell.Utility {Add-Member, Add-Type, Clear-Variable, Compare-Ob…
Script 1.4.7 PackageManagement {Find-Package, Find-PackageProvider, Get-Package,…
Script 2.2.5 PowerShellGet {Find-Command, Find-DscResource, Find-Module, Fin…
Binary 3.0.17 beta17 PowerShellGet {Find-PSResource, Get-PSResource, Get-PSResourceR…
Script 2.1.0 PSReadLine {Get-PSReadLineKeyHandler, Get-PSReadLineOption, …Andres Bohren (@BohrenAn) thanks for sharing this info! There's 2 aspects to it. Firstly, with searching for packages installed under "Program Files" included in the path, that denotes machine wide scope, so to search for it you would need to add
-Scope AllUsers(instead of the default which isCurrentUser). So an example would beGet-PSResource -Name "PowerShellGet" -Scope AllUsers.Secondly, modules/scripts installed on WindowsPowerShell (i.e they have
"WindowsPowerShell"included in their path), would not be accessible from PowerShell6+. But, modules/scripts installed on PowerShell6+ are accessible from WindowsPowerShell. For you to resolve your issue, if you can installMicrosoftTeamsthrough PowerShell7 then it should be discoverable and accessible withGet-PSResource. Please let us know if that works, thanks!PowerShell 7 started as Administrator
PS C:\> get-host Name : ConsoleHost Version : 7.2.7 InstanceId : 9a2e4618-12e0-45ad-8558-dfdd8e1e91ba UI : System.Management.Automation.Internal.Host.InternalHostUserInterface CurrentCulture : en-CH CurrentUICulture : en-US PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy DebuggerEnabled : True IsRunspacePushed : False Runspace : System.Management.Automation.Runspaces.LocalRunspace PS C:\> Get-InstalledModule Icewolf.EXO.Spamanalyze Get-Package: No match was found for the specified search criteria and module names 'Icewolf.EXO.Spamanalyze'. PS C:\> Install-Module Icewolf.EXO.Spamanalyze -Scope AllUsers PS C:\> Get-InstalledModule Icewolf.EXO.Spamanalyze Get-Package: No match was found for the specified search criteria and module names 'Icewolf.EXO.Spamanalyze'. PS C:\> Install-Module Icewolf.EXO.Spamanalyze -Scope CurrentUser PS C:\> Get-InstalledModule Icewolf.EXO.Spamanalyze Get-Package: No match was found for the specified search criteria and module names 'Icewolf.EXO.Spamanalyze'.It works with the MicrosoftTeams Module
PS C:\> Get-InstalledModule MicrosoftTeams | fl Name, Version, InstalledLocation Name : MicrosoftTeams Version : 4.9.0 InstalledLocation : C:\Program Files\PowerShell\Modules\MicrosoftTeams\4.9.0With PowerShell 5
PS C:\> get-host Name : ConsoleHost Version : 5.1.19041.1682 InstanceId : dde0cb43-049f-40cf-8d53-c5002aa1db09 UI : System.Management.Automation.Internal.Host.InternalHostUserInterface CurrentCulture : en-US CurrentUICulture : en-US PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy DebuggerEnabled : True IsRunspacePushed : False Runspace : System.Management.Automation.Runspaces.LocalRunspace PS C:\> Get-InstalledModule MicrosoftTeams | fl Name, Version, InstalledLocation Name : MicrosoftTeams Version : 4.9.0 InstalledLocation : C:\Program Files\WindowsPowerShell\Modules\MicrosoftTeams\4.9.0The Module is installed in two Directorys (has to be installed in each PowerShell Version separatly)
C:\Program Files\WindowsPowerShell\Modules\MicrosoftTeams\4.9.0 (PowerShell 5) C:\Program Files\PowerShell\Modules\MicrosoftTeams\4.9.0 (PowerShell 7) But check this out (PowerShell 7) PS C:\> get-InstalledModule PnP.PowerShell Get-Package: No match was found for the specified search criteria and module names 'PnP.PowerShell'. PS C:\> get-package PnP.PowerShell Get-Package: No package found for 'PnP.PowerShell'. PS C:\> install-Module PnP.PowerShell WARNING: Version '1.9.0' of module 'PnP.PowerShell' is already installed at 'C:\Program Files\WindowsPowerShell\Modules\PnP.PowerShell\1.9.0'. To install version '1.11.0', run Install-Module and add the -Force parameter, this command will install version '1.11.0' side-by-side with version '1.9.0'. PS C:\>Seems to be that you can install some Modules and some not.
Some modules you can load even if they are installed in "C:\Program Files\WindowsPowerShell\Modules"PS C:\> get-module ModuleType Version PreRelease Name ExportedCommands ---------- ------- ---------- ---- ---------------- Manifest 7.0.0.0 Microsoft.PowerShell.Management {Add-Content, Clear-Content, Clear-Item, Clear-ItemProperty…} Manifest 7.0.0.0 Microsoft.PowerShell.Security {ConvertFrom-SecureString, ConvertTo-SecureString, Get-Acl, Get-AuthenticodeSig… Manifest 7.0.0.0 Microsoft.PowerShell.Utility {Add-Member, Add-Type, Clear-Variable, Compare-Object…} Script 1.4.7 PackageManagement {Find-Package, Find-PackageProvider, Get-Package, Get-PackageProvider…} Script 2.2.5 PowerShellGet {Find-Command, Find-DscResource, Find-Module, Find-RoleCapability…} Script 2.1.0 PSReadLine {Get-PSReadLineKeyHandler, Get-PSReadLineOption, Remove-PSReadLineKeyHandler, S… PS C:\> import-module PnP.PowerShell PS C:\> get-module ModuleType Version PreRelease Name ExportedCommands ---------- ------- ---------- ---- ---------------- Manifest 7.0.0.0 Microsoft.PowerShell.Management {Add-Content, Clear-Content, Clear-Item, Clear-ItemProperty…} Manifest 7.0.0.0 Microsoft.PowerShell.Security {ConvertFrom-SecureString, ConvertTo-SecureString, Get-Acl, Get-AuthenticodeSig… Manifest 7.0.0.0 Microsoft.PowerShell.Utility {Add-Member, Add-Type, Clear-Variable, Compare-Object…} Script 1.4.7 PackageManagement {Find-Package, Find-PackageProvider, Get-Package, Get-PackageProvider…} Manifest 1.9.0 PnP.PowerShell {Add-PnPAlert, Add-PnPApp, Add-PnPApplicationCustomizer, Add-PnPAzureADGroupMem… Script 2.2.5 PowerShellGet {Find-Command, Find-DscResource, Find-Module, Find-RoleCapability…} Script 2.1.0 PSReadLine {Get-PSReadLineKeyHandler, Get-PSReadLineOption, Remove-PSReadLineKeyHandler, S…It's not consistent in any way. And i am not able to install several Modules in PowerShell 7. Find it very confusing...
Andres Bohren (@BohrenAn) we completely understand the frustration with this PowerShellGet V2 behavior. We are working on PowerShellGet V3 to be less confusing and handle such scenarios better. If you try finding the installed
MicrosoftTeamspackage with the PowerShellGetV3 cmdletGet-PSResourcelike such:Get-PSResource -Name "MicrosoftTeams" -Scope AllUsersare you able to find it?Install-Module in PowerShell 5 is default to AllUsers?
Install-Module in PowerShell 7 is default to CurrentUser?
Did i get that right?Here is the Output you asked for in PowerShell 7
PS C:> Get-Module
ModuleType Version PreRelease Name ExportedCommands
Manifest 7.0.0.0 Microsoft.PowerShell.Management {Add-Content, Clear-Content, Clear-Item, Clear-ItemProperty…}
Manifest 7.0.0.0 Microsoft.PowerShell.Security {ConvertFrom-SecureString, ConvertTo-SecureString, Get-Acl, …
Manifest 7.0.0.0 Microsoft.PowerShell.Utility {Add-Member, Add-Type, Clear-Variable, Compare-Object…}
Script 1.4.8.1 PackageManagement {Find-Package, Find-PackageProvider, Get-Package, Get-Packag…
Binary 3.0.17 beta17 PowerShellGet {Find-PSResource, Get-PSResource, Get-PSResourceRepository, …
Script 2.2.5 PowerShellGet {Find-Command, Find-DscResource, Find-Module, Find-RoleCapab…
Script 2.2.6 PSReadLine {Get-PSReadLineKeyHandler, Get-PSReadLineOption, Remove-PSRe…PS C:> Get-InstalledModule -Name "MicrosoftTeams"
Version Name Repository Description
4.9.0 MicrosoftTeams PSGallery Microsoft Teams cmdlets module for Windows PowerShe…
PS C:> Get-PSResource -Name "MicrosoftTeams" -Scope AllUsers
Name Version Prerelease Repository Description
MicrosoftTeams 4.9.0 PSGallery Microsoft Teams cmdlets module for Windows PowerShell and PowerShell Core.…
PS C:> Get-PSResource -Name "MicrosoftTeams" -Scope CurrentUser
PS C:>Andres Bohren (@BohrenAn)
PSGet 2.2.5 (and its cmdlet Install-Module) defaults to CurrentUser for PowerShell5 and 7.
Lower versions of PSGet may not default to CurrentUser.

Prerequisites
Steps to reproduce
As you can see below, i am using PowerShell 7. Seems that Get-InstalledModule does not work there.
Get-Module does work.
See also: PowerShell/PowerShell#12271
PS C:> get-host
Name : ConsoleHost
Version : 7.2.6
InstanceId : fd07e65c-c9a5-4e9a-b473-661fc858c9a1
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : en-CH
CurrentUICulture : en-US
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled : True
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspace
PS C:> Get-InstalledModule MicrosoftTeams
Get-Package: No match was found for the specified search criteria and module names 'MicrosoftTeams'.
PS C:> Get-Module MicrosoftTeams -ListAvailable
ModuleType Version PreRelease Name PSEdition ExportedCommands
Script 4.8.0 MicrosoftTeams Core,Desk {Add-TeamChannelUser, Add-TeamUser, Connect-MicrosoftTeams, Disconnect-MicrosoftTeams…}
PS C:> Get-Module PowerShellGet -ListAvailable
ModuleType Version PreRelease Name PSEdition ExportedCommands
Binary 3.0.17 beta17 PowerShellGet Desk {Find-PSResource, Get-PSResource, Get-PSResourceRepository, Install-PSResource…}
ModuleType Version PreRelease Name PSEdition ExportedCommands
Script 2.2.5 PowerShellGet Desk {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapability…}
ModuleType Version PreRelease Name PSEdition ExportedCommands
Binary 3.0.17 beta17 PowerShellGet Desk {Find-PSResource, Get-PSResource, Get-PSResourceRepository, Install-PSResource…}
Script 2.2.5 PowerShellGet Desk {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapability…}
Script 1.0.0.1 PowerShellGet Desk {Install-Module, Find-Module, Save-Module, Update-Module…}
PS C:>
Expected behavior
Get-InstalledModule -Name <ModuleName> #Returns Information about installed ModuleActual behavior
Error details
No response
Environment data
Version
PowerShellGet 2.2.5
Visuals