A what-if message describing what version would be installed only.
Actual behavior
What if: Performing the operation "Install-PSResource" on target "Package to install: 'Microsoft.PowerShell.PSResourceGet', version: '1.0.1'".
What if: Performing the operation "Install-PSResource" on target "Exit ShouldProcess".
Install-PSResource: Package(s) 'Microsoft.PowerShell.PSResourceGet' could not be installed from repository 'PSGallery'.
That is:
an extraneous 'What if:' line is printed
an error is unexpectedly reported aftewards
Error details
Exception :
Type : Microsoft.PowerShell.PSResourceGet.UtilClasses.ResourceNotFoundException
Message : Package(s) 'Microsoft.PowerShell.PSResourceGet' could not be installed from repository 'PSGallery'.
HResult : -2146233088
TargetObject : Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource
CategoryInfo : InvalidData: (Microsoft.PowerShel…s.InstallPSResource:InstallPSResource) [Install-PSResource], ResourceNotFoundException
FullyQualifiedErrorId : InstallPackageFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource
InvocationInfo :
MyCommand : Install-PSResource
ScriptLineNumber : 1
OffsetInLine : 1
HistoryId : 18
Line : Install-PSResource Microsoft.PowerShell.PSResourceGet -WhatIf
Statement : Install-PSResource Microsoft.PowerShell.PSResourceGet -WhatIf
PositionMessage : At line:1 char:1
+ Install-PSResource Microsoft.PowerShell.PSResourceGet -WhatIf
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
InvocationName : Install-PSResource
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo :
Environment data
PowerShell 7.4.1 on macOS 14.2.1, module version 1.2.5
Prerequisites
Steps to reproduce
Expected behavior
A what-if message describing what version would be installed only.
Actual behavior
That is:
Error details
Environment data
Visuals
No response