Prevent unnecessary installation actions
This commit is contained in:
parent
9ba134d202
commit
f25e892faf
2 changed files with 18 additions and 8 deletions
scripts/Windows/Software/PinnedItem
|
@ -20,12 +20,15 @@ Start-SoftwareInstaller @parameters -Installer {
|
|||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
$feature = "NetFx3";
|
||||
|
||||
if ((Get-WindowsOptionalFeature -Online -FeatureName $feature).State -ne "Enabled") {
|
||||
Write-Host "Enabling ``$feature`` feature…";
|
||||
choco install --source windowsFeatures -y $feature;
|
||||
}
|
||||
|
||||
$module = $Arguments.Name;
|
||||
& $Arguments.Installer @PSBoundParameters;
|
||||
|
||||
if (-not (& { powershell -NoProfile -Command "Import-Module $module; exit ([bool]`$Error)" 2> $null; $?; })) {
|
||||
$feature = "NetFx3";
|
||||
|
||||
if ((Get-WindowsOptionalFeature -Online -FeatureName $feature).State -ne "Enabled") {
|
||||
Write-Host "Enabling ``$feature`` feature…";
|
||||
choco install --source windowsFeatures -y $feature;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue