Skip to content

Commit

Permalink
update PackageManagement module onlz if necessarz
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejs4 committed Nov 9, 2022
1 parent c204744 commit 408c57f
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions stp.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -749,15 +749,14 @@ Process {

Install-PackageProvider -Name nuget -Force -ForceBootstrap -Scope allusers | Out-Null

# if (!(Get-Module -ListAvailable PSScriptAnalyzer)) {
# " - installing 'PSScriptAnalyzer' PS module"
# Install-Module PSScriptAnalyzer -SkipPublisherCheck -Force
# }

" - updating 'PackageManagement' PS module"
# solves issue https://github.com/PowerShell/vscode-powershell/issues/2824
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Install-Module -Name PackageManagement -Force -ErrorAction SilentlyContinue
" - updating 'PackageManagement' PS module"
if (Get-Module PackageManagement -ListAvailable | ? version -GT ([version]'1.4.8')) {
" - already installed"
} else {
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Install-Module -Name PackageManagement -Force -ErrorAction SilentlyContinue
}

if ((Get-ExecutionPolicy -Scope LocalMachine) -notmatch "Bypass|RemoteSigned") {
# because of PS Global Profile loading
Expand Down

0 comments on commit 408c57f

Please sign in to comment.