win_psmodule - Missing SkipPublisherCheck in Prerq installations (#58090)

* win_psmodule - Missing SkipPublisherCheck in Prerq installations

* Handle different minors of PS5

* community revisions

* Update win_psmodule.ps1
This commit is contained in:
Shachaf92 2019-07-05 01:00:58 +03:00 committed by Jordan Borean
parent db5656cf6e
commit 6e319ff088
2 changed files with 13 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- "win_psmodule - Missing SkipPublisherCheck in Prerq installations"

View file

@ -69,7 +69,17 @@ Function Install-PrereqModule {
}
else {
try {
Install-Module -Name $Name -MinimumVersion $PrereqModules[$Name] -Force -WhatIf:$CheckMode | Out-Null
$install_params = @{
Name = $Name
MinimumVersion = $PrereqModules[$Name]
Force = $true
WhatIf = $CheckMode
}
if ((Get-Command -Name Install-Module).Parameters.ContainsKey('SkipPublisherCheck')) {
$install_params.SkipPublisherCheck = $true
}
Install-Module @install_params > $null
if ( $Name -eq 'PowerShellGet' ) {
# An order has to be reverted due to dependency