From cfa93052f810477a67ab254f2586cc198a626411 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sun, 2 Jul 2023 18:05:06 +0200 Subject: [PATCH] Install missing features for TrackMania --- .../Software/TrackMania Nations Forever/Manage.ps1 | 10 ++++++---- .../Software/TrackMania United Forever/Manage.ps1 | 11 +++++++---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/scripts/Windows/Software/TrackMania Nations Forever/Manage.ps1 b/scripts/Windows/Software/TrackMania Nations Forever/Manage.ps1 index ed50347f..e073f71f 100644 --- a/scripts/Windows/Software/TrackMania Nations Forever/Manage.ps1 +++ b/scripts/Windows/Software/TrackMania Nations Forever/Manage.ps1 @@ -10,12 +10,14 @@ $null = New-Module { } function Restore-TmNations([Context] $context) { - $feature = "DirectPlay"; + $features = @("DirectPlay", "NetFx3"); Write-Host "Restoring TrackMania Nations Forever"; - if (-not (Get-WindowsOptionalFeature -Online -FeatureName $feature).State) { - Write-Information "Enabling the ``$feature`` feature"; - Enable-WindowsOptionalFeature -Online -All -FeatureName $feature; + foreach ($feature in $features) { + if (-not (Get-WindowsOptionalFeature -Online -FeatureName $feature).State) { + Write-Information "Enabling the ``$feature`` feature"; + Enable-WindowsOptionalFeature -Online -All -FeatureName $feature; + } } Write-Information "Installing TrackMania Nations Forever"; diff --git a/scripts/Windows/Software/TrackMania United Forever/Manage.ps1 b/scripts/Windows/Software/TrackMania United Forever/Manage.ps1 index 0d9e18e7..cbfd1f1c 100644 --- a/scripts/Windows/Software/TrackMania United Forever/Manage.ps1 +++ b/scripts/Windows/Software/TrackMania United Forever/Manage.ps1 @@ -10,11 +10,14 @@ $null = New-Module { } function Restore-TmUnited([Context] $context) { - $feature = "DirectPlay"; + $features = @("DirectPlay", "NetFx3"); Write-Host "Restoring TrackMania United Forever"; - - if (-not (Get-WindowsOptionalFeature -Online -FeatureName $feature).State) { - Enable-WindowsOptionalFeature -Online -All -FeatureName $feature; + + foreach ($feature in $features) { + if (-not (Get-WindowsOptionalFeature -Online -FeatureName $feature).State) { + Write-Information "Enabling the ``$feature`` feature"; + Enable-WindowsOptionalFeature -Online -All -FeatureName $feature; + } } Write-Information "Determining location of setup file";