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??

Chris D.
  • 21
  • 1
  • 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. – Sage Pourpre Mar 28 '22 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. – Chris D. Mar 28 '22 at 21:00

1 Answers1

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"
}
TheMadTechnician
  • 34,906
  • 3
  • 42
  • 56
  • 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. – Chris D. Mar 29 '22 at 12:57
  • if it doesn't exist then it's never been set, which is just as good for your case. – TheMadTechnician Mar 29 '22 at 16:30