Skip to content

Commit a5cb843

Browse files
committed
Upgrade PowerShellGet if it's too old
1 parent d02ed40 commit a5cb843

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Install-RequiredModule.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
Push-Location $PSScriptRoot
2+
3+
# Some people only have a really old version of PowerShellGet that doesn't support pre-release modules
4+
if (!(Get-Command Install-Module -ParameterName 'AllowPrerelease' -ErrorAction 'SilentlyContinue')) {
5+
$Module = Install-Module 'PowerShellGet' -Repository 'PSGallery' -MaximumVersion 2.99 -MinimumVersion 2.2.5 -Force -Scope CurrentUser -PassThru
6+
Remove-Module PowerShellGet
7+
Import-Module PowerShellGet -MinimumVersion $Module.Version -Force
8+
}
9+
210
try {
311
$Script = Install-Script Install-RequiredModule -PassThru -Force
412
& (Join-Path $Script.InstalledLocation Install-RequiredModule.ps1)

0 commit comments

Comments
 (0)