PortValhalla/scripts/Windows/Scripts/Prerequisites.ps1

31 lines
889 B
PowerShell

#!/bin/pwsh
. "$PSScriptRoot/../../Common/Scripts/Context.ps1";
[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"))
{
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;
}