Very strange. I was trying to upgrade oh-my-posh from v2 to v3, the method is documented here. However, when I run command
Update-Module -Name oh-my-posh -Scope CurrentUser
Powershell shows
Update-Module : A parameter cannot be found that matches parameter name 'Scope'.
At line:1 char:32
+ Update-Module -Name oh-my-posh -Scope CurrentUser
+ ~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Update-Module], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Update-Module
I've seen many people using this -Scope parameter very often. I don't get why my powershell can't find this parameter.
Using Windows (integrated) Powershell, $PSVersionTable:
PSVersion 5.1.19041.1023
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.1023
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
The version of Update-Module that shipped with Windows PowerShell versions up to v5[1] apparently did not have a -Scope parameter - see the linked help topic.
The help topic suggests that which scope is targeted is implied by whether the PowerShell session is elevated (run as admin), in which the AllUsers scope is targeted, or not, in which case CurrentUser is implied.
However, you should be able to update the PowerShellGet module, which the Update-Module cmdlet is a part of, via the PowerShell Gallery, which should give you a -Scope parameter thereafter:
# Run from an ELEVATED session.
# Initial upgrade to the latest version from the PowerShell Gallery.
# Thereafter, use `Update-Module PowerShellGet` for future updates.
# Add -Verbose to see details.
Install-Module -Scope AllUsers PowerShellGet -Force -AllowClobber
Phillip Ngan reports that -AllowClobber is needed in order to resolve a name conflict.
[1] I see that your version is v5.1 - yet your PowerShellGet module seems to be outdated; conceivably, a manually installed older version is shadowing the bundled one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With