From 72615ab002ec788509edabe324110afb10b9a881 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sun, 24 Mar 2024 17:37:13 +0100 Subject: [PATCH] Only back up installed Visual Studio versions --- .../Windows/Software/VisualStudio/Manage.ps1 | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/scripts/Windows/Software/VisualStudio/Manage.ps1 b/scripts/Windows/Software/VisualStudio/Manage.ps1 index ef2153bf..903b4752 100644 --- a/scripts/Windows/Software/VisualStudio/Manage.ps1 +++ b/scripts/Windows/Software/VisualStudio/Manage.ps1 @@ -20,19 +20,21 @@ $null = New-Module { Write-Host "Backing up Visual Studio"; foreach ($version in $versions) { - Write-Information "Backing up $($version[1]): $($version[2])"; + if ((choco list -e $version[0])) { + Write-Information "Backing up $($version[1]): $($version[2])"; - $configPath = Get-ConfigPath $context $version[0]; - $null = New-Item -Force -ItemType Directory "$(Split-Path -Parent $configPath)"; + $configPath = Get-ConfigPath $context $version[0]; + $null = New-Item -Force -ItemType Directory "$(Split-Path -Parent $configPath)"; - Start-Process -FilePath "$vsInstaller" ` - -Wait ` - -ArgumentList @( - "export", - "--channelId", "$($version[1])", - "--productId", "$($version[2])", - "--config", "`"$configPath`"", - "--quiet"); + Start-Process -FilePath "$vsInstaller" ` + -Wait ` + -ArgumentList @( + "export", + "--channelId", "$($version[1])", + "--productId", "$($version[2])", + "--config", "`"$configPath`"", + "--quiet"); + } } }