Minor tweaks for windows env
This commit is contained in:
parent
1c4e9feb1f
commit
c5311de65a
3 changed files with 18 additions and 13 deletions
|
@ -1,5 +1,12 @@
|
|||
param([switch]$IgnoreSystem,[switch]$MissingOnly,[switch]$GenInstallCode)
|
||||
param(
|
||||
[switch]$IgnoreSystem,
|
||||
[switch]$MissingOnly,
|
||||
[switch]$GenInstallCode,
|
||||
[switch]$UserScope
|
||||
)
|
||||
|
||||
$local:scopeStr = ""
|
||||
if( $UserScope ) { $scopeStr = " -Scope CurrentUser" }
|
||||
$local:currentSys = @('Always') + ([SystemName]::_GetValidValues('',$true,$true));
|
||||
|
||||
$local:oldPSGet = Get-Module PowerShellGet -ListAvailable -ErrorAction SilentlyContinue |
|
||||
|
@ -11,9 +18,9 @@ if( $local:oldPSGet ) {
|
|||
"PowerShellGet is an old version ($($oldPSGet.Version)), the following code should upgrade it"
|
||||
, "# Set-PSRepository -Name PSGallery -InstallationPolicy Trusted"
|
||||
, " [Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12"
|
||||
, " Install-PackageProvider -Name NuGet -Force"
|
||||
, " Install-PackageProvider -Name NuGet -Force${scopeStr}"
|
||||
, " Remove-Module PowerShellGet"
|
||||
, " Install-Module -Name PowerShellGet -Force"
|
||||
, " Install-Module -Name PowerShellGet -Force${scopeStr}"
|
||||
, " Update-Module -Name PowerShellGet"
|
||||
) -join "`n" )
|
||||
}
|
||||
|
@ -41,5 +48,8 @@ if( $GenInstallCode ) {
|
|||
} | ForEach-Object {
|
||||
if( -not $GenInstallCode ) { return $_ }
|
||||
"Write-Host -ForegroundColor Cyan 'Installing $_...';"
|
||||
"Install-Module $_ -AllowClobber"
|
||||
"Install-Module $_ -AllowClobber${scopeStr}"
|
||||
}
|
||||
if( $GenInstallCode ) {
|
||||
". Reload-MyScripts"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue