PortValhalla/scripts/Windows/Scripts/Prerequisites.ps1

32 lines
971 B
PowerShell

#!/bin/pwsh
. "$PSScriptRoot/Context.ps1";
$Global:InformationPreference = "Continue";
$Global:ErrorActionPreference = "Inquire";
[Context]::new().PreventSleepMode();
$null = powershell -c Get-PackageProvider -ListAvailable NuGet;
if (-not $?) {
Write-Host "Installing NuGet PackageProvider";
powershell -c '$null = Install-PackageProvider -Name NuGet -Force';
}
foreach ($module in @("PSWindowsUpdate", "KnownFolders"))
{
if (-not (Get-Module -ListAvailable $module))
{
Write-Host "Installing PowerShell Module $module";
Install-Module -AcceptLicense -Force "$module";
}
}
foreach ($nativeModule in @("PinnedItem")) {
if (-not (powershell -c Get-Module -ListAvailable $nativeModule)) {
Write-Host "Installing Windows PowerShell Module $nativeModule";
powershell -c Install-Module -Force "$nativeModule";
}
}
if (-not (Get-Command 7z -ErrorAction SilentlyContinue)) {
choco install -y 7zip.portable;
}