diff --git a/eng/scripts/get-aspire-cli.ps1 b/eng/scripts/get-aspire-cli.ps1 index a16f6e1f102..158171057c6 100755 --- a/eng/scripts/get-aspire-cli.ps1 +++ b/eng/scripts/get-aspire-cli.ps1 @@ -732,8 +732,12 @@ function Expand-AspireCliArchive { if (-not (Get-Command Expand-Archive -ErrorAction SilentlyContinue)) { throw "Expand-Archive cmdlet not found. Please use PowerShell 5.0 or later to extract ZIP files." } - - Expand-Archive -Path $ArchiveFile -DestinationPath $DestinationPath -Force -ErrorAction Stop + + Invoke-WithPowerShellVersion -ModernAction { + Expand-Archive -Path $ArchiveFile -OutputPath $DestinationPath -Force -ErrorAction Stop + } -LegacyAction { + Expand-Archive -Path $ArchiveFile -DestinationPath $DestinationPath -Force -ErrorAction Stop + } } else { # Use tar for tar.gz files on Unix systems