diff --git a/Veeam BR Update/Update-Veeam.ps1 b/Veeam BR Update/Update-Veeam.ps1 index 9606f90..86e7386 100644 --- a/Veeam BR Update/Update-Veeam.ps1 +++ b/Veeam BR Update/Update-Veeam.ps1 @@ -85,6 +85,10 @@ param( [bool] $AutoUpgrade = $true ) +# Settting download URL +$downloadURL = "https://download2.veeam.com/VDPP/v12/VeeamDataPlatform_23H2_20240928.iso" +$isoLabel = "VEEAM DATA PLATFORM PREMIUM" + # Setting Log Location $logFolder = $env:SYSTEMDRIVE + "\temp\veeam-upgrade" New-Item -ItemType Directory -Force -Path $logFolder | Out-Null #makes sure folder exists @@ -333,14 +337,14 @@ if ($vbem -and ($license.Length -eq 0)) { # If ISO wasn't specified, download it from Veeam's public servers if ($iso -eq "download") { try { - $iso = "$logFolder\VeeamBackup&Replication_12.1.1.56_20240127.iso" + $iso = "$logFolder\$(($downloadURL -split "/")[-1])" Write-Log "ISO not specified. Checking if previously downloaded..." if (Test-Path $iso) { Write-Log "ISO found: $iso" } else { Write-Log "ISO not found. Downloading ISO now..." - Start-BitsTransfer -Source "https://download2.veeam.com/VBR/v12/VeeamBackup&Replication_12.1.1.56_20240127.iso" -Destination $iso + Start-BitsTransfer -Source $downloadURL -Destination $iso Write-Log "ISO downloaded to: $iso" } } @@ -354,46 +358,30 @@ if ($iso -eq "download") { try { Write-Log "Mounting ISO in Operating System" Mount-DiskImage -ImagePath $iso | Out-Null - $mountDrive = (Get-Volume | Where-Object { $_.FileSystemLabel -like "VEEAM BACKUP" }).DriveLetter + ":" + $mountDrive = (Get-Volume | Where-Object { $_.FileSystemLabel -like $isoLabel })[0].DriveLetter + ":" + if ($mountDrive -eq ":") { + throw "Unable to mount ISO. Please check if the ISO is mounted and has valid lable: $isoLabel" + } } catch { Write-Log $_ throw "ISO mount failed. Please check upgrade log for more information: $logFile" } -# Validating ISO major version -$fileInfo = Get-Content "$mountDrive\autorun.inf" -if ($fileInfo -match "12") { - Write-Log "ISO validated for version 12" -} -else { - Write-Log "ISO failed validation! Non-v12 ISO detected." - Write-Log "Unmounting Veeam ISO" - Dismount-DiskImage -ImagePath $iso - throw "Incorrect ISO detected! This script was designed to work with a Veeam Backup & Replication v12.1 ISO. Please correct and re-run this script." -} - -# Validating 12.1 ISO +# Validating ISO try { # Identifying Silent Install EXE $file = Get-ChildItem -Recurse -Filter "Veeam.Silent.Install.exe" -File -Path $mountDrive $exe = $file.FullName - if ("1.0.0" -eq $file.VersionInfo.ProductVersion) { - Write-Log "ISO failed validation! Non-v12.1 ISO detected." - Write-Log "Unmounting Veeam ISO" - Dismount-DiskImage -ImagePath $iso - throw - } - - Write-Log "ISO validated as version 12.1" + Write-Log "ISO validated, Silent Install EXE found: $exe" } catch { Write-Log $_ - Write-Log "Unable to validate 12.1 ISO. Please investigate and resolve. Logs can be found here: $logFile" + Write-Log "Unable to validate ISO. Please investigate and resolve. Logs can be found here: $logFile" Write-Log "Unmounting Veeam ISO" Dismount-DiskImage -ImagePath $iso - throw "Incorrect ISO detected! This script was designed to work with a Veeam Backup & Replication v12.1 ISO. Please correct and re-run this script." + throw "Incorrect ISO detected! This script was designed to work with a Veeam Backup & Replication ISO. Please correct and re-run this script." } ### VBR PRE-UPGRADE ACTIONS