Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/scripts/install-dbatools-library.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,11 @@ function Install-FromGitHubRelease {

# Download the release
Write-Log "Downloading to: $downloadPath"
# IWR is crazy slow for large downloads
$currentProgressPref = $ProgressPreference
$ProgressPreference = "SilentlyContinue"
Invoke-WebRequest -Uri $releaseUrl -OutFile $downloadPath -ErrorAction Stop
$ProgressPreference = $currentProgressPref

# Extract the archive
Write-Log "Extracting to: $extractPath"
Expand Down
4 changes: 4 additions & 0 deletions private/functions/Invoke-TlsWebRequest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ function Invoke-TlsWebRequest {
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor $_
}

# IWR is crazy slow for large downloads
$currentProgressPref = $ProgressPreference
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest @Args
$ProgressPreference = $currentProgressPref

[Net.ServicePointManager]::SecurityProtocol = $currentVersionTls
}
12 changes: 1 addition & 11 deletions public/Save-DbaKbUpdate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -144,19 +144,9 @@ function Save-DbaKbUpdate {
if ((Get-Command Start-BitsTransfer -ErrorAction Ignore)) {
Start-BitsTransfer -Source $link -Destination $file
} else {
# IWR is crazy slow for large downloads
$currentVersionTls = [Net.ServicePointManager]::SecurityProtocol
$currentSupportableTls = [Math]::Max($currentVersionTls.value__, [Net.SecurityProtocolType]::Tls.value__)
$availableTls = [enum]::GetValues('Net.SecurityProtocolType') | Where-Object { $_ -gt $currentSupportableTls }
$availableTls | ForEach-Object {
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor $_
}

Write-Progress -Activity "Downloading $fileName" -Id 1
(New-Object Net.WebClient).DownloadFile($link, $file)
Invoke-TlsWebRequest -Uri $link -OutFile $file -ErrorAction Stop
Write-Progress -Activity "Downloading $fileName" -Id 1 -Completed

[Net.ServicePointManager]::SecurityProtocol = $currentVersionTls
}
if (Test-Path -Path $file) {
Get-ChildItem -Path $file
Expand Down
2 changes: 1 addition & 1 deletion tests/Get-DbaEstimatedCompletionTime.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Describe $CommandName -Tag IntegrationTests -Skip:$((-not $TestConfig.BigDatabas
$PSDefaultParameterValues["*-Dba*:EnableException"] = $true

if (-not (Test-Path -Path $TestConfig.BigDatabaseBackup) -and $TestConfig.BigDatabaseBackupSourceUrl) {
Invoke-WebRequest -Uri $TestConfig.BigDatabaseBackupSourceUrl -OutFile $TestConfig.BigDatabaseBackup -ErrorAction Stop
Invoke-TlsWebRequest -Uri $TestConfig.BigDatabaseBackupSourceUrl -OutFile $TestConfig.BigDatabaseBackup -ErrorAction Stop
}
$splatRestore = @{
SqlInstance = $TestConfig.instance2
Expand Down
2 changes: 1 addition & 1 deletion tests/Install-DbaDarlingData.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Describe $CommandName -Tag IntegrationTests -Skip:$env:appveyor {
$server.Query("CREATE DATABASE $darlingDbLocalFile")

$outfile = "$tempDir\DarlingData-main.zip"
Invoke-WebRequest -Uri "https://github.com/erikdarlingdata/DarlingData/archive/main.zip" -OutFile $outfile
Invoke-TlsWebRequest -Uri "https://github.com/erikdarlingdata/DarlingData/archive/main.zip" -OutFile $outfile
$resultsLocalFile = Install-DbaDarlingData -SqlInstance $TestConfig.instance3 -Database $darlingDbLocalFile -Branch main -LocalFile $outfile -Force

# We want to run all commands outside of the BeforeAll block without EnableException to be able to test for specific warnings.
Expand Down
2 changes: 1 addition & 1 deletion tests/Install-DbaFirstResponderKit.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Describe $CommandName -Tag IntegrationTests {
$server.Query("CREATE DATABASE $database")

$outfile = "$tempDir\SQL-Server-First-Responder-Kit-main.zip"
Invoke-WebRequest -Uri "https://github.com/BrentOzarULTD/SQL-Server-First-Responder-Kit/archive/main.zip" -OutFile $outfile
Invoke-TlsWebRequest -Uri "https://github.com/BrentOzarULTD/SQL-Server-First-Responder-Kit/archive/main.zip" -OutFile $outfile
$resultsLocalFile = Install-DbaFirstResponderKit -SqlInstance $TestConfig.instance3 -Database $database -Branch main -LocalFile $outfile -Force

# We want to run all commands outside of the BeforeAll block without EnableException to be able to test for specific warnings.
Expand Down
2 changes: 1 addition & 1 deletion tests/Install-DbaMultiTool.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Describe $CommandName -Tag IntegrationTests {
$null = New-Item -Type Container -Path $tempDir

$outfile = "$tempDir\dba-multitool-$branch.zip"
Invoke-WebRequest -Uri "https://github.com/LowlyDBA/dba-multitool/archive/$branch.zip" -OutFile $outfile
Invoke-TlsWebRequest -Uri "https://github.com/LowlyDBA/dba-multitool/archive/$branch.zip" -OutFile $outfile
$resultsLocalFile = Install-DbaMultiTool -SqlInstance $TestConfig.instance3 -Database $database -Branch $branch -LocalFile $outfile -Force

# We want to run all commands outside of the BeforeAll block without EnableException to be able to test for specific warnings.
Expand Down