2024-11-01 12:12:16 +00:00
|
|
|
. "$PSScriptRoot/../../../lib/Software.ps1";
|
2024-10-13 13:35:24 +00:00
|
|
|
. "$PSScriptRoot/../../../Common/Software/powershell/Module.ps1";
|
2024-08-08 02:36:35 +00:00
|
|
|
|
2024-08-22 21:55:41 +00:00
|
|
|
$parameters = Get-ModuleInstallerComponents "PinnedItem" -NativeOnly -NoProfile;
|
2024-08-08 02:36:35 +00:00
|
|
|
|
|
|
|
foreach ($key in $PSBoundParameters.Keys) {
|
|
|
|
$parameters.Add($key, $PSBoundParameters.TryGetValue($key));
|
|
|
|
}
|
|
|
|
|
2024-09-29 15:12:44 +00:00
|
|
|
$context = $parameters.context;
|
|
|
|
$context.Add("Installer", $parameters.installer);
|
2024-08-08 03:21:21 +00:00
|
|
|
|
2024-10-13 20:07:44 +00:00
|
|
|
Start-SoftwareInstaller -Force @args @parameters -Installer {
|
2024-08-08 03:21:21 +00:00
|
|
|
param(
|
2024-09-29 15:12:44 +00:00
|
|
|
[hashtable] $Context
|
2024-08-08 03:21:21 +00:00
|
|
|
)
|
|
|
|
|
2024-09-21 00:14:47 +00:00
|
|
|
$providerName = "NuGet";
|
2024-09-29 15:12:44 +00:00
|
|
|
$module = $Context.Name;
|
2024-09-21 00:14:47 +00:00
|
|
|
|
|
|
|
if ({ $null = powershell -c "Get-PackageProvider -ListAvailable $providerName"; $? }) {
|
2024-09-30 03:00:42 +00:00
|
|
|
$null = powershell -c "Install-PackageProvider -Force $providerName -Scope AllUsers";
|
2024-09-21 00:14:47 +00:00
|
|
|
}
|
|
|
|
|
2024-09-29 15:12:44 +00:00
|
|
|
& $Context.Installer @PSBoundParameters;
|
2024-08-08 03:21:21 +00:00
|
|
|
|
2024-08-26 23:57:46 +00:00
|
|
|
if (-not (& { powershell -NoProfile -Command "Import-Module $module; exit ([bool]`$Error)" 2> $null; $?; })) {
|
|
|
|
$feature = "NetFx3";
|
2024-08-08 03:21:21 +00:00
|
|
|
|
2024-08-26 23:57:46 +00:00
|
|
|
if ((Get-WindowsOptionalFeature -Online -FeatureName $feature).State -ne "Enabled") {
|
|
|
|
Write-Host "Enabling ``$feature`` feature…";
|
|
|
|
choco install --source windowsFeatures -y $feature;
|
|
|
|
}
|
|
|
|
}
|
2024-08-08 03:21:21 +00:00
|
|
|
}
|