diff --git a/scripts/Windows/OS/Install.ps1 b/scripts/Windows/OS/Install.ps1 index 7d63a4bf..b1268aa1 100644 --- a/scripts/Windows/OS/Install.ps1 +++ b/scripts/Windows/OS/Install.ps1 @@ -4,6 +4,7 @@ . "$PSScriptRoot/../Scripts/Config.ps1"; . "$PSScriptRoot/../Scripts/Hooks.ps1"; . "$PSScriptRoot/../Scripts/PowerManagement.ps1"; +. "$PSScriptRoot/../Scripts/SoftwareManagement.ps1"; . "$PSScriptRoot/../Scripts/Update.ps1"; . "$PSScriptRoot/../Scripts/Context.ps1"; . "$PSScriptRoot/../Software/Firefox/Install.ps1"; @@ -27,7 +28,7 @@ function Start-InstallationLoop { if ($null -eq (Get-Stage)) { Set-Stage ([SetupStage]::Initialize); } elseif ((Get-Stage) -eq ([SetupStage]::Initialize)) { - if (-not ((Get-Command "choco") -and (Get-Command "refreshenv"))) { + if (-not ((Test-Command "choco") -and (Test-Command "refreshenv"))) { Invoke-Hook "Install-Chocolatey" -Fallback { # Install chocolatey [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; @@ -39,7 +40,7 @@ function Start-InstallationLoop { continue; } - if (-not (Test-ChocoSoftware "powershell-core")) { + if (-not (Test-ChocoPackage "powershell-core")) { Invoke-Hook "Install-PowerShellCore" -Fallback { choco install -y powershell-core --install-arguments='"ADD_FILE_CONTEXT_MENU_RUNPOWERSHELL=1 ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=1 REGISTER_MANIFEST=1 USER_MU=1 ENABLE_MU=1"'; }; diff --git a/scripts/Windows/Scripts/Choco.ps1 b/scripts/Windows/Scripts/Choco.ps1 deleted file mode 100644 index 99b89e5e..00000000 --- a/scripts/Windows/Scripts/Choco.ps1 +++ /dev/null @@ -1,15 +0,0 @@ -<# - .SYNOPSIS - Checks whether the specified package has been installed using Chocolatey. - - .PARAMETER Name - The name of the package to check. -#> -function Test-ChocoSoftware { - [OutputType([bool])] - param( - [string] $Name - ); - - -not [string]::IsNullOrEmpty((choco list --limit-output --exact $name)); -}