From 102e3933f3d033ff561cd7d63928f471583de7e7 Mon Sep 17 00:00:00 2001 From: Kitty Cat Date: Sun, 7 Jul 2024 16:37:13 -0400 Subject: [PATCH] initenv: install pscore using winget --- initenv.ps1 | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/initenv.ps1 b/initenv.ps1 index 3b88f18..bbded61 100644 --- a/initenv.ps1 +++ b/initenv.ps1 @@ -7,12 +7,9 @@ if (!(Get-Module -ListAvailable -Name Microsoft.WinGet.Client)) { # Get installed applications so that we can identify what needs to be installed $InstalledApplications = Get-WmiObject -Class Win32_Product -# PowerShell 7 -if (-not ($InstalledApplications | where Name -EQ "PowerShell 7-x64")) { - echo "Installing PowerShell 7" - cd "$env:USERPROFILE\Downloads" - Invoke-WebRequest -Uri 'https://github.com/PowerShell/PowerShell/releases/download/v7.3.6/PowerShell-7.3.6-win-x64.msi' -OutFile powershell.msi - msiexec.exe /package powershell.msi /quiet ENABLE_PSREMOTING=1 ADD_PATH=1 +# Install PowerShell Core +if (!(Get-WinGetPackage -Source "winget" -MatchOption "Equals" -Id "Microsoft.PowerShell")) { + Install-WinGetPackage -Source "winget" -MatchOption "Equals" -Id "Microsoft.PowerShell" -Override "/passive ENABLE_PSREMOTING=1 ADD_PATH=1" } # Vim90