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
3 changes: 3 additions & 0 deletions private/configurations/settings/commands.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ Set-DbatoolsConfig -FullName 'commands.test-elevationrequirement.disable' -Value

# Get-DbaDbTable
Set-DbatoolsConfig -FullName 'commands.get-dbadbtable.clearandinitialize' -Value $false -Initialize -Validation bool -Description "Controls whether Get-DbaDbTable uses ClearAndInitialize to load all table properties in one optimized query. Set to true to enable the optimization, which loads all properties in a single query but clears already loaded SMO properties. Keep at false when reusing SMO objects across multiple calls (e.g. in Copy-DbaDbTableData)."

# Invoke-TlsWebRequest
Set-DbatoolsConfig -FullName 'commands.invoke-tlswebrequest.disableautoproxy' -Value $false -Initialize -Validation bool -Description "Disable automatic system proxy detection in Invoke-TlsWebRequest. Set to true to skip auto-detection of the system proxy (useful if auto-detection causes issues in your environment)."
11 changes: 10 additions & 1 deletion private/functions/Invoke-TlsWebRequest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,18 @@ function Invoke-TlsWebRequest {
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor $_
}

# Auto-detect system proxy if not already configured and not opted out
if (-not (Get-DbatoolsConfigValue -FullName "commands.invoke-tlswebrequest.disableautoproxy") -and -not [System.Net.WebRequest]::DefaultWebProxy.Address) {
$systemProxy = [System.Net.WebRequest]::GetSystemWebProxy()
if ($systemProxy) {
[System.Net.WebRequest]::DefaultWebProxy = $systemProxy
[System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
}
}

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

Expand Down
Loading