Install-Module reports all modules from PSGallery as unsigned.
Prerequisites
- [x] Write a descriptive title.
- [x] Make sure you are able to repro it on the latest released version
- [x] Search the existing issues.
Steps to reproduce
When running install-module (as imported from PowerShellGet 3.023), Install-PSResource returns an error stating that the target module is unsigned.
Install-PSResource: The signature status for 'Microsoft.Graph' file 'Microsoft.Graph.psd1' is 'NotSigned'.
Expected behavior
`Install-Module` which is supposed to be a compatibility mode wrapper for `Install-PSResource` should successfully install modules.
Actual behavior
> Install-Module Microsoft.Graph -RequiredVersion 2.30.0 -Repository PSGallery
Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its Trusted value by
running the Set-PSResourceRepository cmdlet. Are you sure you want to install the PSResource from 'PSGallery'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): y
Install-PSResource: The signature status for 'Microsoft.Graph' file 'Microsoft.Graph.psd1' is 'NotSigned'. Status message: 'The file C:\Users\jole001\AppData\Local\Temp\22cbf8bd-a310-45e1-9f42-bb1b4216fad0\microsoft.graph\2.30.0\Microsoft.Graph.psd1 is not digitally signed. You cannot run this script on the current system. For more information about running scripts and setting execution policy, see about_Execution_Policies at https://go.microsoft.com/fwlink/?LinkID=135170'
Install-PSResource: Package(s) 'Microsoft.Graph' could not be installed from repository 'PSGallery'.
Error details
Exception :
Type : Microsoft.PowerShell.PSResourceGet.UtilClasses.ResourceNotFoundException
Message : Package(s) 'Microsoft.Graph' 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 : 6
Line : Install-Module Microsoft.Graph -RequiredVersion 2.30.0 -Repository PSGallery
Statement : Install-Module Microsoft.Graph -RequiredVersion 2.30.0 -Repository PSGallery
PositionMessage : At line:1 char:1
+ Install-Module Microsoft.Graph -RequiredVersion 2.30.0 -Repository PS …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
InvocationName : Install-Module
CommandOrigin : Internal
ScriptStackTrace : at Install-Module<Process>, C:\Users\jole001\OneDrive - Hennepin
County\Documents\PowerShell\Modules\PowerShellGet\3.0.23\PowerShellGet.psm1: line 1158
at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo :
0
1
Environment data
PS> get-module Microsoft.PowerShell.PSResourceGet; $PSVersionTable | Format-Table
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Binary 1.1.1 Microsoft.PowerShell.PSResourceGet {Compress-PSResource, Find-PSResource, Get-InstalledP…
Name Value
---- -----
PSVersion 7.5.2
PSEdition Core
GitCommitId 7.5.2
OS Microsoft Windows 10.0.22631
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
Using Install-PSResource directly works normally, even in the same session.
Edit: Seems like there is an issue for this already: https://github.com/PowerShell/PowerShellGet/issues/48.
From the error message it seems like you are using PowerShellGet v3.0.23-beta23 (there is no stable version of this release AFAIK):
This is a shim or proxy for PSResourceGet. More reading:
- https://learn.microsoft.com/en-us/powershell/module/powershellget
- https://github.com/PowerShell/PowerShellGet
The last link is where you should create an issue for this.
Having said that, it looks like that project isn't highly prioritized. There have never been a stable v3 release of it. Don't expect a swift solution.