PortValhalla/scripts/Windows/Scripts/Modules.ps1

18 lines
507 B
PowerShell

#!/bin/pwsh
param (
[string]$ModuleName,
[switch]$WindowsPowerShell
)
if ($WindowsPowerShell) {
if (-not (powershell -c Get-Module -ListAvailable $ModuleName)) {
Write-Host "Installing Windows PowerShell Module $ModuleName";
powershell -c Install-Module -Force "$ModuleName";
}
} else {
if (-not (Get-Module -ListAvailable $ModuleName)) {
Write-Host "Installing PowerShell Module $ModuleName";
Install-Module -AcceptLicense -Force "$ModuleName";
}
}