Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Find-PSResource' - Specifying exact name and version does not return an unlisted package (like 'Find-Module' does) #1771

Open
3 tasks done
jnunn-aws opened this issue Jan 9, 2025 · 0 comments

Comments

@jnunn-aws
Copy link

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

I am having a problem with Find-PSResource. I am expecting an unlisted module to be returned when I specify the exact name and version but nothing is returned.

In contrast, Find-Module does return the unlisted module when I specify the exact name and version.

Additional Context:

The root3i module specified in my examples was published for test purposes only. All of its versions are unlisted.

Motivation:

We own automation for installing, updating, and uninstalling hundreds of modules. Modules no longer need to be updated and should be removed when the service that they correspond to has been retired/discontinued. There is no property to designate that a module is retired/discontinued. It appears that the best way to indicate that a PowerShell module on PSGallery is retired/discontinued is to unlist all versions. The ability to target unlisted modules with Find-PSResource confirms that a module is indeed unlisted and not just missing because of an issue such as the PSGallery is in a degraded state.

Expected behavior

> Find-PSResource -Name root3i -Version 1.0.0 -Repository PSGallery
Name    Version Prerelease Repository Description
----    ------- ---------- ---------- -----------
root3i  1.0.0              PSGallery  This is a test module to test publishing

Actual behavior

> Find-PSResource -Name root3i -Version 1.0.0 -Repository PSGallery

Error details

Find-PSResource: Package with name 'root3i', version '1.0.0' could not be found in repository 'PSGallery'

Environment data

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Binary     1.0.6                 Microsoft.PowerShell.PSResourceGet  {Find-PSResource, Get-InstalledPSResource, Get-PS…

Key   : PSVersion
Value : 7.4.2
Name  : PSVersion


Key   : PSEdition
Value : Core
Name  : PSEdition


Key   : GitCommitId
Value : 7.4.2
Name  : GitCommitId


Key   : OS
Value : Microsoft Windows 10.0.19045
Name  : OS


Key   : Platform
Value : Win32NT
Name  : Platform


Key   : PSCompatibleVersions
Value : {1.0, 2.0, 3.0, 4.0…}
Name  : PSCompatibleVersions


Key   : PSRemotingProtocolVersion
Value : 2.3
Name  : PSRemotingProtocolVersion


Key   : SerializationVersion
Value : 1.1.0.1
Name  : SerializationVersion


Key   : WSManStackVersion
Value : 3.0
Name  : WSManStackVersion

Visuals

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant