From 4d155a6b4fb83bf7693741cac8539a3e45f78853 Mon Sep 17 00:00:00 2001 From: pwnb0y Date: Mon, 29 Aug 2022 11:25:29 +0530 Subject: [PATCH] install.ps1 is modified --- install.ps1 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/install.ps1 b/install.ps1 index 08434c74..342a671d 100644 --- a/install.ps1 +++ b/install.ps1 @@ -12,7 +12,17 @@ $fullUrl = $url + $packageName New-Item -Path $BASE_DIR -ItemType "directory" -ErrorAction SilentlyContinue # Download the binary -Invoke-WebRequest -Uri $fullUrl -OutFile $BASE_DIR\kubescape.exe +$useBitTransfer = $null -ne (Get-Module -Name BitsTransfer -ListAvailable) -and ($PSVersionTable.PSVersion.Major -le 5) +if ($useBitTransfer) + { + Write-Information -MessageData 'Using a fallback BitTransfer method since you are running Windows PowerShell' + Start-BitsTransfer -Source $fullUrl -Destination $BASE_DIR\kubescape.exe + + } + else + { + Invoke-WebRequest -Uri $fullUrl -OutFile $BASE_DIR\kubescape.exe + } # Update user PATH if needed $currentPath = [Environment]::GetEnvironmentVariable("Path", "User")