Prevent unnecessary installation actions
This commit is contained in:
parent
9ba134d202
commit
f25e892faf
2 changed files with 18 additions and 8 deletions
scripts/Common/Software/PowerShell
|
@ -34,7 +34,14 @@ $null = New-Module {
|
|||
)
|
||||
|
||||
$env:PENDING_MODULE_NAME = $Arguments.Name;
|
||||
$installAction = { Install-Module -Scope AllUsers -Force $env:PENDING_MODULE_NAME @args };
|
||||
|
||||
$installAction = {
|
||||
$module = $env:PENDING_MODULE_NAME;
|
||||
|
||||
if (-not (Get-Module -ListAvailable $module -ErrorAction SilentlyContinue)) {
|
||||
Install-Module -Scope AllUsers -Force $module @args;
|
||||
}
|
||||
};
|
||||
|
||||
if (-not $Arguments.NativeOnly) {
|
||||
& $installAction -AcceptLicense;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue