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
When I upgrade to Powershell 7.0.0 I'm unable to load powershellget and get errors pointing to importing Microsoft.Powershell.utility #12040
InvalidOperation: C:\Users\USERNAME\Documents\WindowsPowerShell\Modules\PowerShellGet\2.2.1\PSModule.psm1:327
Line | 327 | $NoMatchFound = $LocalizedData.NoMatchFound
~~~~~~~~~~~~~~
| The variable '$LocalizedData' cannot be retrieved because it has not been set.
When trying to import powershellget i've also found the error a little more specific:
Import-LocalizedData: C:\Users\USERNAME\Documents\WindowsPowerShell\Modules\Powershellget\2.2.1\PSModule.psm1:1
Line |
1 | Import-LocalizedData LocalizedData -filename PSGet.Resource.psd1
| ~~~~~~~~~~~~~~~~~~~~
| The 'Import-LocalizedData' command was found in the module
| 'Microsoft.PowerShell.Utility', but the module could not be loaded. For more
| information, run ....
Trying to run the suggested command Import-Module Microsoft.Powershell.utility and I get the following:
Import-Module: Failed to generate proxies for remote module 'Microsoft.PowerShell.Utility'. The 'Export-PSSession' command was found in the module 'Microsoft.PowerShell.Utility', but the module could not be loaded. For more information, run 'Import-Module Microsoft.PowerShell.Utility'.
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
changed the title [-]My bug report[/-][+]When I upgrade to Powershell 7.0.0 I'm unable to load many modules and get errors pointing to importing Microsoft.Powershell.utility[/+]on Mar 5, 2020
changed the title [-]When I upgrade to Powershell 7.0.0 I'm unable to load many modules and get errors pointing to importing Microsoft.Powershell.utility[/-][+]When I upgrade to Powershell 7.0.0 I'm unable to load powershellget and get errors pointing to importing Microsoft.Powershell.utility[/+]on Mar 5, 2020
Looks like version 2.2.1 of PowerShellGet is not the latest one and installed in WindowsPowerShell module path; So I would first try to install the latest one from pwsh by Install-Module -Name PowerShellGet -MinimumVersion 2.2.3 -Repository PSGallery
then start a fresh pwsh 7.0.0 from desktop (as opposed to 'from other pwsh' or 'from powershell.exe') and do the Import-Module PowershellGet.
This leads me to two main questions for those of us who have been using windows + core and not upgraded to 7.
Are both of these folders used in 7? Is it something to do with compatibility?
'c:\Program Files\powershell\7\Modules'
'C:\Program Files\PowerShell\Modules'
Do I need to distribute now some ranked psmodule path hierarchy to force certain ordering of psmodule path to avoid this type of error in the future?
sheldonhull (@sheldonhull) What looks suspicious to me is that WindowsPS paths precede CorePS paths.
Is the order of paths in those arrays exactly like $ENV:PSModulePath value when a fresh pwsh is started?
c:\Program Files\powershell\7\Modules - is probably the install location of PS Core,
PS7 puts the PS7 User path for modules ahead of the Windows PowerShell User path. sheldonhull (@sheldonhull) are you explicitly setting PSModulePath in your Profile or somewhere else?
Steve Lee (@SteveL-MSFT) I don't remember doing that, but I just edited to help solve that issue. Should I remove any entries or any type of prevention/fix I can apply in the future?
sheldonhull (@sheldonhull) hard to say without understanding what your specific use case is, but for most users, I would expect they don't mess with PSModulePath directly and so this shouldn't be a problem.
Activity
[-]My bug report[/-][+]When I upgrade to Powershell 7.0.0 I'm unable to load many modules and get errors pointing to importing Microsoft.Powershell.utility[/+][-]When I upgrade to Powershell 7.0.0 I'm unable to load many modules and get errors pointing to importing Microsoft.Powershell.utility[/-][+]When I upgrade to Powershell 7.0.0 I'm unable to load powershellget and get errors pointing to importing Microsoft.Powershell.utility[/+]anmenaga commentedon Mar 6, 2020
Looks like version
2.2.1ofPowerShellGetis not the latest one and installed in WindowsPowerShell module path; So I would first try to install the latest one frompwshbyInstall-Module -Name PowerShellGet -MinimumVersion 2.2.3 -Repository PSGallerythen start a fresh
pwsh7.0.0 from desktop (as opposed to 'from other pwsh' or 'from powershell.exe') and do theImport-Module PowershellGet.sheldonhull commentedon Mar 6, 2020
This helped point me in the right direction. I figured it might be a conflict with versions. Here's what failed
Then I moved to
powershell/7/Modulesabove the other path and it correctly ran like below:This leads me to two main questions for those of us who have been using windows + core and not upgraded to 7.
Are both of these folders used in 7? Is it something to do with compatibility?
'c:\Program Files\powershell\7\Modules'
'C:\Program Files\PowerShell\Modules'
Do I need to distribute now some ranked psmodule path hierarchy to force certain ordering of psmodule path to avoid this type of error in the future?
anmenaga commentedon Mar 6, 2020
sheldonhull (@sheldonhull) What looks suspicious to me is that WindowsPS paths precede CorePS paths.
Is the order of paths in those arrays exactly like
$ENV:PSModulePathvalue when a freshpwshis started?c:\Program Files\powershell\7\Modules- is probably the install location of PS Core,SteveL-MSFT commentedon Mar 6, 2020
PS7 puts the PS7 User path for modules ahead of the Windows PowerShell User path. sheldonhull (@sheldonhull) are you explicitly setting PSModulePath in your Profile or somewhere else?
sheldonhull commentedon Mar 7, 2020
Steve Lee (@SteveL-MSFT) I don't remember doing that, but I just edited to help solve that issue. Should I remove any entries or any type of prevention/fix I can apply in the future?
SteveL-MSFT commentedon Mar 18, 2020
sheldonhull (@sheldonhull) hard to say without understanding what your specific use case is, but for most users, I would expect they don't mess with PSModulePath directly and so this shouldn't be a problem.