Skip to content

Save-PSResource -AsNupkg causes pipeline input to fail #948

Open
@ThomasNieto

Description

@ThomasNieto

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

Using -AsNupkg causes pipeline input to fail. Notice the error message name for the resource is the type name not resource.

Find-PSResource snmp | Save-PSResource -Path c:\temp -AsNupkg -TrustRepository -PassThru

Expected behavior

# works

Actual behavior

Find-PSResource snmp | Save-PSResource -Path c:\temp -AsNupkg -TrustRepository -PassThru
Save-PSResource: Package 'Microsoft.PowerShell.PowerShellGet.UtilClasses.PSResourceInfo' with requested version range '(, )' could not be found in any trusted repositories

Error details

Exception             :
    Type    : System.ArgumentException
    Message : Package 'Microsoft.PowerShell.PowerShellGet.UtilClasses.PSResourceInfo' with requested version range '(,
)' could not be found in any trusted repositories
    HResult : -2147024809
CategoryInfo          : ObjectNotFound: (:) [Save-PSResource], ArgumentException
FullyQualifiedErrorId : ResourceNotFoundError,Microsoft.PowerShell.PowerShellGet.Cmdlets.SavePSResource
InvocationInfo        :
    MyCommand        : Save-PSResource
    ScriptLineNumber : 1
    OffsetInLine     : 24
    HistoryId        : 13
    Line             : Find-PSResource snmp | Save-PSResource -Path c:\temp -AsNupkg -TrustRepository -PassThru
    PositionMessage  : At line:1 char:24
                       + … urce snmp | Save-PSResource -Path c:\temp -AsNupkg -TrustRepository - …
                       +               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    InvocationName   : Save-PSResource
    CommandOrigin    : Internal
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo :

Environment data

3.0.19

Name                           Value
----                           -----
PSVersion                      7.3.2
PSEdition                      Core
GitCommitId                    7.3.2
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions