param( $Action, [hashtable] $Arguments ) . "$PSScriptRoot/../../../Common/Scripts/Software.ps1"; . "$PSScriptRoot/../../../Common/Scripts/System.ps1"; Start-SoftwareInstaller @PSBoundParameters ` -Installer { $file = "TmUnitedForever.exe"; $dir = New-TemporaryDirectory; foreach ($feature in @("DirectPlay", "NetFx3")) { if ((Get-WindowsOptionalFeature -Online -FeatureName $feature).State -ne "Enabled") { Write-Information "Enabling the ``$feature`` feature…"; choco install --source windowsFeatures -y $feature; } } $null = Push-Location $dir; Write-Host "Downloading TrackMania United Forever…"; Invoke-WebRequest "http://files.trackmaniaforever.com/tmunitedforever_setup.exe" -OutFile "$file"; Write-Host "Starting installation…"; Start-Process -Wait -FilePath $file -ArgumentList "/Silent"; Remove-DesktopIcon "*TmUnitedForever*"; $null = Pop-Location; Remove-Item -Recurse $dir; }; # ToDo: Add restoration