PortValhalla/scripts/Windows/Scripts/Prerequisites.ps1

26 lines
803 B
PowerShell

#!/bin/pwsh
$Global:InformationPreference = "Continue";
$Global:ErrorActionPreference = "Inquire";
$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";
}
}