diff --git a/scripts/Windows/OS/Install.ps1 b/scripts/Windows/OS/Install.ps1 index 74879f19..664ef6ec 100644 --- a/scripts/Windows/OS/Install.ps1 +++ b/scripts/Windows/OS/Install.ps1 @@ -160,25 +160,39 @@ $null = New-Module { wsl --shutdown; continue; } + + Invoke-Hook "Install-PSModules" -Fallback { + $modules = @( + @("KnownFolders"), + @("PSWindowsUpdate"), + @("PSScriptAnalyzer"), + @("LocalAccounts", $true), + @("NuGet") + ); + + foreach ($module in $modules) { + $parameters = @{ }; + + if ($module[1]) { + $parameters = @{ + allowPrerelease = $true; + }; + } + + Install-Module -Scope AllUsers -AcceptLicense -Force $module[0] @parameters; + Import-Module $module[0]; + } + + . "$PSScriptRoot/../Software/PinnedItem/Manage.ps1"; + }; if (-not (Test-PSPackage Selenium.WebDriver)) { Write-Host "Installing browser automation tools…"; - Install-Module -AcceptLicense -Force NuGet; - Import-Module NuGet; $null = Install-Package -Force Selenium.WebDriver -RequiredVersion 4.10.0 -SkipDependencies; continue; } Install-ChocoPackage selenium-gecko-driver firefox; - - Invoke-Hook "Install-PSModules" -Fallback { - Install-Module -Scope AllUsers -AcceptLicense -Force KnownFolders; - Install-Module -Scope AllUsers -AcceptLicense -Force PSWindowsUpdate; - Install-Module -Scope AllUsers -AcceptLicense -Force PSScriptAnalyzer; - Install-Module -Scope AllUsers -AcceptLicense -AllowPrerelease -AllowClobber -Force LocalAccounts; - Import-Module LocalAccounts; - . "$PSScriptRoot/../Software/PinnedItem/Manage.ps1"; - }; Install-WingetPackage AutoHotkey.AutoHotkey; Set-Stage ([SetupStage]::Configure);