2

I have a Windows Server 2019 instance that used to have a proxy server configured in its proxy setting but has since been disabled from Proxy Settings -> Proxy

If I run the powershell 5.1 command:

Invoke-WebRequest https://<LOCALURL>

then i'm still directed though the previously configured proxy and my request is denied. If I run the same command though powershell 7.2 then it works as expected.

I've made the following changes to try to rid any residual proxy configurations but nothing has worked.

  • Disabled MigrateProxy: hcu\software\microsoft\windows\currentversion\internet settings\MigrateProxy: Changed from 1 to 0
  • netsh winhttp import proxy source=ie
  • netsh winhttp reset proxy
  • Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name ProxyEnable -Type DWord -Value 0
  • Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name ProxyServer -Type String -Value ""
  • Searched and combed for proxy values in the registry
  • Restarted numerous times

Where is powershell 5.1 still pulling the removed proxy configuration from??

2
  • Did you check internet explorer options ? It is usually where I go first when I have to deal with something like it (It is counter-intuitive but these settings affect the whole system and not IE specifically). The quick way to go there the run window (Win+R) then type inetcpl.cpl. From there go into the Connecitons tab and checik if there's anything configured present. Commented Mar 28, 2022 at 20:46
  • Thanks for the reply! Ran the command as instructed. The Proxy server settings are blank under: Internet Properties -> Connections -> LAN settings. I tried this as both my regular user and as the Administrator. Commented Mar 28, 2022 at 21:00

1 Answer 1

1

You can make sure that you don't have anything in your DefaultConnectionSettings, which is a byte array and has to be parsed, but you can check that for the current user and local machine keys, and that may be causing you grief:

$KeyPath = '\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections'
$PropertyName = 'DefaultConnectionSettings'

$LMBytes = Get-ItemPropertyValue -Path "HKLM:$KeyPath" -Name $PropertyName
$LMProxyStringLength = $LMBytes[12]
If(!$LMProxyStringLength){Write-Host "No proxy set for Local Machine key"}else{
    $LMProxyString = ($LMBytes[16..(16+$LMBytes[12])]|%{[char]$_}) -join ''
    Write-Warning "Local Machine proxy set to $LMProxyString"
}

$CUBytes = Get-ItemPropertyValue -Path "HKCU:$KeyPath" -Name $PropertyName
$CUProxyStringLength = $CUBytes[12]
If(!$CUProxyStringLength){Write-Host "No proxy set for Current User key"}else{
    $CUProxyString = ($CUBytes[16..(16+$CUBytes[12])]|%{[char]$_}) -join ''
    Write-Warning "Local Machine proxy set to $CUProxyString"
}
Sign up to request clarification or add additional context in comments.

2 Comments

Thank you for the response. I ran your script but it complained that there was no Property for "DefaultConnectionSettings" I then did a search in the registry for that string and the only hit was HKEY_USERS:\UUID\software\microsoft\windows\currentversion\internetsettings\connections\ DefaultConnectionStrings had a null value.
if it doesn't exist then it's never been set, which is just as good for your case.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.