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
When attempting to install a script hosted in the psgallery using the "install-psresource" cmdlet, I get the below errors:
Install-PSResource: Could not parse
'C:\Users\john\AppData\Local\Temp\bf32a0d9-88bd-4af8-864c-2829bb06c73d\wimwitch\3.4.6\WIMWitch.ps1' as a PowerShell script file due to missing the closing
'#>' for HelpInfo comment block
Install-PSResource: PSScriptFile could not be parsed
Install-PSResource: Package(s) 'wimwitch' could not be installed from repository 'PSGallery'.
The command that I ran to produce the above error is as follows:
install-psresource -Name wimwitch
However, I was able to successfully install the script when I used the save-script cmdlet from early versions of powershellget (versions that did not depend on and utilize psresourceget). Furthermore, this does affect all psgallery scripts, as I am able to successfully install other psgallery scripts using "install-psresource" successfully. This tells me that there is something specific about the wimwitch script that the module does not like when attempting to parse it, but it is does contain the closing "#>" that psresourceget claims is missing.
Expected behavior
PS > install-psresource -Name wimwitch
(Script successfully installs on computer)
Actual behavior
PS > install-psresource -Name wimwitch
(See above error)
Error details
get-error
Exception :
Type :
Microsoft.PowerShell.PSResourceGet.UtilClasses.ResourceNotFoundException
Message : Package(s) 'wimwitch' 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.PSResourceGe t.Cmdlets.InstallPSResource
InvocationInfo :
MyCommand : Install-PSResource
ScriptLineNumber : 1
OffsetInLine : 1
HistoryId : 9
Line : install-psresource wimwitch
PositionMessage : At line:1 char:1
+ install-psresource wimwitch
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
InvocationName : install-psresource
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo :
Environment data
Get-Module Microsoft.PowerShell.PSResourceGet; $PSVersionTable | Format-Table
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Binary 1.0.0 Microsoft.PowerShell.PSResourceGet {Find-PSResource, Get-InstalledPSResource, Get-PSResourceRepository, Get-PSScriptFileInfo…}
Name Value
---- -----
PSVersion 7.3.8
PSEdition Core
GitCommitId 7.3.8
OS Microsoft Windows 10.0.22621
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