Closed
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
I cannot pipe the output from Get-PSResouceRepository
to Set-PSResourceRepository
. The error message that is thrown is also not something that I would expect. This issue can be fixed by adding ValueFromPipelineByPropertyName
on the Name
parameter.
Expected behavior
PS /> Get-PSResourceRepository | Set-PSResourceRepository -Trusted
Actual behavior
PS /> Get-PSResourceRepository | Set-PSResourceRepository -Trusted
Set-PSResourceRepository: Updating to repository store failed: Cannot find the repository because it does not exist. Try registering the repository using 'Register-PSResourceRepository'
PS /> Get-PSResourceRepository
Name Uri Trusted Priority
---- --- ------- --------
PSGallery https://www.powershellgallery.com/api/v2 False 50
PS /> Set-PSResourceRepository -Name PSGallery -Trusted
Error details
PS /> Get-Error
Exception :
Type : System.Management.Automation.PSInvalidOperationException
ErrorRecord :
Exception :
Type : System.Management.Automation.ParentContainsErrorRecordException
Message : Updating to repository store failed: Cannot find the repository because it does not exist. Try registering the reposi
tory using 'Register-PSResourceRepository'
HResult : -2146233087
CategoryInfo : InvalidOperation: (:) [], ParentContainsErrorRecordException
FullyQualifiedErrorId : InvalidOperation
TargetSite :
Name : ThrowTerminatingError
DeclaringType : System.Management.Automation.MshCommandRuntime, System.Management.Automation, Version=7.2.4.500, Culture=neutral, PublicKe
yToken=31bf3856ad364e35
MemberType : Method
Module : System.Management.Automation.dll
Message : Updating to repository store failed: Cannot find the repository because it does not exist. Try registering the repository
using 'Register-PSResourceRepository'
Source : System.Management.Automation
HResult : -2146233079
StackTrace :
at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)
TargetObject : Microsoft.PowerShell.PowerShellGet.Cmdlets.SetPSResourceRepository
CategoryInfo : InvalidArgument: (Microsoft.PowerShel…SResourceRepository:SetPSResourceRepository) [Set-PSResourceRepository], PSInvalidOp
erationException
FullyQualifiedErrorId : ErrorInNameParameterSet,Microsoft.PowerShell.PowerShellGet.Cmdlets.SetPSResourceRepository
InvocationInfo :
MyCommand : Set-PSResourceRepository
ScriptLineNumber : 1
OffsetInLine : 28
HistoryId : 14
Line : Get-PSResourceRepository | Set-PSResourceRepository -Trusted
PositionMessage : At line:1 char:28
+ Get-PSResourceRepository | Set-PSResourceRepository -Trusted
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
InvocationName : Set-PSResourceRepository
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
Environment data
PS /> Get-Module PowerShellGet
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Binary 3.0.14 beta14 PowerShellGet
PS /> Get-Module PowerShellGet
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Binary 3.0.14 beta14 PowerShellGet
Visuals
No response