Skip to content

Commit

Permalink
Fix: Add UserAgent (#43164)
Browse files Browse the repository at this point in the history
* Resolves Trenly#142
  • Loading branch information
Trenly authored Jan 27, 2022
1 parent a9193d0 commit dc889c2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Tools/YamlCreate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ Function Test-Url {
)
try {
$HTTP_Request = [System.Net.WebRequest]::Create($URL)
$HTTP_Request.UserAgent = "Microsoft-Delivery-Optimization/10.1"
$HTTP_Response = $HTTP_Request.GetResponse()
$HTTP_Status = [int]$HTTP_Response.StatusCode
} catch {
Expand Down Expand Up @@ -358,6 +359,7 @@ Function Get-InstallerFile {

# Create a new web client for downloading the file
$_WebClient = [System.Net.WebClient]::new()
$_WebClient.Headers.Add("User-Agent", "Microsoft-Delivery-Optimization/10.1")
# If the system has a default proxy set, use it
# Powershell Core will automatically use this, so it's only necessary for PS5
if ($PSVersionTable.PSVersion.Major -lt 6) { $_WebClient.Proxy = [System.Net.WebProxy]::GetDefaultProxy() }
Expand Down

0 comments on commit dc889c2

Please sign in to comment.