Only back up installed Visual Studio versions

This commit is contained in:
Manuel Thalmann 2024-03-24 17:37:13 +01:00
parent 6e806af2a0
commit 72615ab002

View file

@ -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");
}
}
}