Skip to content

Add new scope argument to Get-PSResource that returns CurrentUser and AllUsers resources #860

Description

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues.

Steps to reproduce

Get-PSResource should return both CurrentUser and AllUsers installed resources by default. If the scope parameter is used then it should limit to search.

Expected behavior

Returns both CurrentUser and AllUsers resources.

Actual behavior

Returns both CurrentUser resources.

Error details

No response

Environment data

Name          Version
----          -------
PowerShellGet 3.0.16

Name                           Value
----                           -----
PSVersion                      7.3.0
PSEdition                      Core
GitCommitId                    7.3.0
OS                             Microsoft Windows 10.0.19044
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

No response

Activity

  1. JustinGrote commented on Nov 18, 2022

    @JustinGrote
    Contributor

    Somewhat related, ideally the "CurrentUser" path should be detectable from pwsh and not guessed by PowerShellGet, so please support PowerShell/PowerShell#18613 as a change as well.

  2. alerickson commented on Jan 18, 2023

    @alerickson
    Member

    This behavior (default scope is CurrentUser scope) is consistent with PowerShell scoping, so we want to remain consistent.

  3. ThomasNieto commented on Jan 18, 2023

    @ThomasNieto
    ContributorAuthor

    alerickson what existing behavior are you referring to? The reason it should be updated is that Get-Module returns both current user and all users modules.

    Consider this use case. A user wants to use a specific module however when they get the list of installed it doesn't appear and so they install it. However, the system admin already installed that module in the all users scope. This creates a redundant situation.

  4. ghost closed this as completedon Jan 18, 2023
  5. PaulHigin commented on Jan 19, 2023

    @PaulHigin
    Contributor

    Thomas Nieto (@ThomasNieto) Get-Module is not really a good comparison as it doesn't have a -Scope parameter like Get-PSResource does. In general we want to be consistent with PowerShell -Scope parameter where the default scope is CurrentUser.

    However, we can certainly consider adding a new AllScopes -Scope parameter argument to return installed resources for both current user and machine scopes. I'll re-open this as an enhancement issue.

    In the meantime a workaround is to simply call Get-PSResource twice with the two different scope arguments.

  6. ghost closed this as completedon Jan 19, 2023
  7. changed the title [-]Get-PSResource without scope should return CurrentUser and AllUsers resources[/-] [+]Add new scope argument to Get-PSResource that returns CurrentUser and AllUsers resources[/+] on Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions