You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Get-InstalledModule not working the same in v7.0 as in Windows PowerShell v5.1 #12271
PowerShell module Az is already installed on the system and can be confirmed in PS v5.1 using the same cmdlet.
Get-InstalledModule -Name Az
Expected behavior
Get-InstalledModule -Name Az
Version Name Repository Description
------- ---- ---------- -----------
3.7.0 Az PSGallery Microsoft Azure PowerShell - Cmdlets to manage..
Actual behavior
Get-Package: C:\program files\powershell\7\Modules\PowerShellGet\PSModule.psm1:9423
Line |
9423 | PackageManagement\Get-Package @PSBoundParameters | Microsoft. …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| No match was found for the specified search criteria and module names 'Az'.
Environment data
Name Value
---- -----
PSVersion 7.0.0
PSEdition Core
GitCommitId 7.0.0
OS Microsoft Windows 10.0.18363
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
The issue reads similarly to another that has been closed #12040
If I try to install the module in PWSH v7.0 it doesn't error but also doesn't install the module:
install-module -name az
Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its
InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from
'PSGallery'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): y
Get-InstalledModule -Name Az
Get-Package: C:\program files\powershell\7\Modules\PowerShellGet\PSModule.psm1:9423
Line |
9423 | PackageManagement\Get-Package @PSBoundParameters | Microsoft. …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| No match was found for the specified search criteria and module names 'Az'.
Trying to import the module appears to do something as the screen doesn't respond for a couple of minutes (about the length of time you'd expect it to take if the module was being imported). However, get-installedmodule still errors
import-module -name az
Get-InstalledModule -Name Az
Get-Package: C:\program files\powershell\7\Modules\PowerShellGet\PSModule.psm1:9423
Line |
9423 | PackageManagement\Get-Package @PSBoundParameters | Microsoft. …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| No match was found for the specified search criteria and module names 'Az'.
After importing, running Get-Module does list the module
AzureAD is not compatible with PowerShell Core, only Az.
I guess the issue with Az due to WinCompat feature. /cc Andrew (@anmenaga)
Try to uninstall Az module from Windows PowerShell and leave it only in PowerShell Core.
Looks like module paths are outside of System32, so implicit WinCompat should not auto-engage unless module uses WinPS-only cmdlets during import (relatively rare situation). A way to check that:
start a fresh PS 7.0
import-module -name az #assuming there are no errors here
Get-PSSession
if there are no PS sessions returned - WinCompat was not used.
Get-Module -Name az | select ModuleType,Version # if WinCompat was used, then ModuleType would be Script and Version would be 1.0
alerickson Have you seen such errors from Get-Package/PowerShellGet ?
Paul Bendall (@PaulBendall) I think this is happening because the Az module was originally installed in WindowsPS. I can repro that way, but don't have any issues if installing in in Core (and vice versa). PSGet seems to be only looking at the module paths for that particular edition of PS. This scenario is also currently failing with the beta version of PowerShellGet 3.0, so I'll open an issue there to address it.
For your issue with installing try running [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
first and then let me know if installation is successful.
Not sure of status here, being as still open, but Ryan Yates (@kilasuit) says it should go to PowerShellGetv2 team, but I've just noticed this bug behavior with
Get-InstalledModule dbatools
I was able to install to latest, and Get-Module does show the latest installed
I'm facing the oposite problem. Get-InstalledModule it's working fine but when I try to uninstall a module, it seems to do it but it don't
Uninstall-Module -Name AzureAd -Verbose -Force
VERBOSE: Performing the operation "Uninstall-Module" on target "Version '2.0.2.140' of module 'AzureAD'".
VERBOSE: Successfully uninstalled the module 'AzureAD' from module base 'C:\Users\MyFolder\Documents\PowerShell\Modules\AzureAD\2.0.2.140'.
I restart the console and
Get-InstalledModule -Name AzureAD
Version Name Repository Description
2.0.2.140 AzureAD PSGallery Azure Active Directory V2 General Availability Module.…
Its still there.
How can I remove completely any module from pwsh.exe? Any help would be appreciate.
Activity
PaulBendall commentedon Apr 7, 2020
Further to the issue:
If I try to install the module in PWSH v7.0 it doesn't error but also doesn't install the module:
Trying to import the module appears to do something as the screen doesn't respond for a couple of minutes (about the length of time you'd expect it to take if the module was being imported). However, get-installedmodule still errors
After importing, running Get-Module does list the module
PaulBendall commentedon Apr 8, 2020
Further update based on more testing:
Did a test with the module AzureAD which was originally installed under Admin context in PowerShell v5.1:
iSazonov commentedon Apr 8, 2020
AzureAD is not compatible with PowerShell Core, only Az.
I guess the issue with Az due to WinCompat feature. /cc Andrew (@anmenaga)
Try to uninstall Az module from Windows PowerShell and leave it only in PowerShell Core.
anmenaga commentedon Apr 8, 2020
Looks like module paths are outside of System32, so implicit WinCompat should not auto-engage unless module uses WinPS-only cmdlets during import (relatively rare situation). A way to check that:
import-module -name az#assuming there are no errors hereGet-PSSessionGet-Module -Name az | select ModuleType,Version# if WinCompat was used, then ModuleType would beScriptand Version would be1.0alerickson Have you seen such errors from
Get-Package/PowerShellGet?Paul Bendall (@PaulBendall) also, what is the value of
$env:PSModulePathin a fresh PS 7.0 ?MaximoTrinidad commentedon Apr 8, 2020
Just an FYI
Its been mention, in recent posts about AzureAD module, it can work using the Import-Module with the "-UseWindowsPowerShell" parameter.
Still, this is just a way to make it work until the AD Team (not Azure) can make it work with PowerShell 7.
:)
alerickson commentedon Apr 9, 2020
Paul Bendall (@PaulBendall) I think this is happening because the Az module was originally installed in WindowsPS. I can repro that way, but don't have any issues if installing in in Core (and vice versa). PSGet seems to be only looking at the module paths for that particular edition of PS. This scenario is also currently failing with the beta version of PowerShellGet 3.0, so I'll open an issue there to address it.
For your issue with installing try running
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12first and then let me know if installation is successful.
kilasuit commentedon Dec 10, 2020
This is not a PowerShell issue but actually a PowerShellGetv2 issue and this issue should be transferred to that repository
davesbrown commentedon Mar 2, 2022
Not sure of status here, being as still open, but Ryan Yates (@kilasuit) says it should go to PowerShellGetv2 team, but I've just noticed this bug behavior with
I was able to install to latest, and Get-Module does show the latest installed
ThomasNieto commentedon Aug 18, 2023
Sydney Smith (@SydneyhSmith) can this issue be closed/moved to the PSGet v2 repository?
kilasuit commentedon Aug 19, 2023
Closing this as a duplicate of PowerShell/PowerShellGetv2#684 (which is a newer repro of this issue)
microsoft-github-policy-service commentedon Aug 20, 2023
This issue has been marked as duplicate and has not had any activity for 1 day. It has been closed for housekeeping purposes.
microsoft-github-policy-service commentedon Aug 20, 2023
This issue has been marked as external and has not had any activity for 1 day. It has been be closed for housekeeping purposes.
SydneyhSmith commentedon Aug 21, 2023
Steve Lee (@SteveL-MSFT) can you please transfer or give me transfer rights in this repo 😄
d3xtr01D commentedon Sep 1, 2023
I'm facing the oposite problem. Get-InstalledModule it's working fine but when I try to uninstall a module, it seems to do it but it don't
Uninstall-Module -Name AzureAd -Verbose -Force
VERBOSE: Performing the operation "Uninstall-Module" on target "Version '2.0.2.140' of module 'AzureAD'".
VERBOSE: Successfully uninstalled the module 'AzureAD' from module base 'C:\Users\MyFolder\Documents\PowerShell\Modules\AzureAD\2.0.2.140'.
I restart the console and
Get-InstalledModule -Name AzureAD
Version Name Repository Description
2.0.2.140 AzureAD PSGallery Azure Active Directory V2 General Availability Module.…
Its still there.
How can I remove completely any module from pwsh.exe? Any help would be appreciate.