Disable proxy settings at system level

Today I was facing some issues with the proxy server at the company I was working for.
It seemed that a rule was applied that made all servers connect outbound trough a proxy, instead of only the desktops as provided.

In an attempt to quickly resolve this issue, I quickly searched the internet.
I found that its rather easy to find how to disable the proxy settings using GPO, or at a user level. However it was not that easy to find how to disable this at a system level.

It seems that there are 2 registry keys that need to be created (or modified) to do this.
These registry keys are located at HKLM:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings

Step 1, disable the user based proxy settings:
In the HKLM:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings there is a DWORD called ProxySettingsPerUser, if this is set to 0 it will be disabled and system wide settings are used. Put it back to 1 or remove this key entirely to enable user based proxy settings again.

Step 2, disable the automatic detect proxy settings checkbox.
In the HKLM:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings there is a DWORD called EnableAutoProxyResultCache, set it to 0 and it will be disabled.

Here is a simple script you can use to inject these settings into the registry directly.

$regPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings"
$null = New-ItemProperty -Path $regPath -Name 'ProxySettingsPerUser' -Value 0 -PropertyType DWORD -Force
$null = New-ItemProperty -Path $regPath -Name 'EnableAutoProxyResultCache' -Value 0 -PropertyType DWORD -Force

~Danny