Windows-proxy-instellingen configureren

Overzicht

In dit artikel wordt uitgelegd hoe je proxy-instellingen configureert in Windows, onderverdeeld in gebruikersniveau (WinINET) en systeemniveau (WinHTTP).
Voorbeeld: ProxyServer = http=<<PROXY_ADDRESS>>;https=<<PROXY_ADDRESS>>
Omgevingsafhankelijke waarden worden weergegeven als <<variabelenaam>>.


Variabele notatie

Gebruik de volgende tabel om waarden aan te passen aan je eigen omgeving:

Variabele Voorbeeldwaarde Opmerking
<<PROXY_ADDRESS>> proxy.example.com:8080 Hostnaam en poortnummer van de proxyserver
<<PROXY_BYPASS>> intranet.example.com;192.168.*;<local> Domeinen of subnetten die de proxy omzeilen, gescheiden door ;
<<ADVPROXY_SETTINGS_PATH>> C:\proxy-settings.json Pad naar het configuratiebestand voor advproxy

Stap 1: Begrijp de soorten proxyconfiguraties

Type Toepassing Gebruik
Gebruikersniveau (WinINET) Ingelogde gebruiker Wordt toegepast op browsers en gebruikersapplicaties. Gebaseerd op IE/Edge-instellingen
Systeemniveau (WinHTTP) Systeembreed / services Wordt gebruikt door Windows Update, BITS en Defender-communicatie

BITS (Background Intelligent Transfer Service) verzorgt efficiënte achtergrondoverdrachten, bijvoorbeeld voor Windows Update of Defender-updates.
Omdat dit onder het LocalSystem-account draait, gelden de WinINET-instellingen niet automatisch.


Stap 2: Proxy op gebruikersniveau configureren via PowerShell

$proxy = "<<PROXY_ADDRESS>>"
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" `
  -Name ProxyEnable -Value 1
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" `
  -Name ProxyServer -Value "http=$proxy;https=$proxy"
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" `
  -Name ProxyOverride -Value "<<PROXY_BYPASS>>"

Controleer de instellingen:

Get-ItemProperty "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" | Select ProxyEnable, ProxyServer, ProxyOverride

Stap 3: Proxy instellen op systeemniveau (WinHTTP / BITS)

① Oudere methode (Windows Server 2019 en ouder)

netsh winhttp set proxy <<PROXY_ADDRESS>> "<<PROXY_BYPASS>>"
netsh winhttp show proxy

② Nieuwe methode (aanbevolen voor Windows Server 2022 en later)

Maak een JSON-bestand aan:

@'
{
  "ProxyIsEnabled": true,
  "Proxy": "http=<<PROXY_ADDRESS>>;https=<<PROXY_ADDRESS>>",
  "ProxyBypass": "<<PROXY_BYPASS>>",
  "AutoConfigIsEnabled": false,
  "AutoDetect": false
}
'@ | Out-File "<<ADVPROXY_SETTINGS_PATH>>" -Encoding ascii

Pas de instellingen toe:

netsh winhttp set advproxy setting-scope=machine settings-file="<<ADVPROXY_SETTINGS_PATH>>"

Voor snelle testen kun je instellingen ook direct in de opdrachtregel definiëren zonder JSON-bestand:

netsh winhttp set advproxy setting-scope=machine settings='{\"ProxyIsEnabled\":true,\"Proxy\":\"http=<<PROXY_ADDRESS>>;https=<<PROXY_ADDRESS>>\",\"ProxyBypass\":\"<<PROXY_BYPASS>>\",\"AutoConfigIsEnabled\":false,\"AutoDetect\":false}'

Stap 4: BITS-proxy-instellingen toepassen op het LocalSystem-account

bitsadmin /util /setieproxy localsystem MANUAL_PROXY <<PROXY_ADDRESS>> "<<PROXY_BYPASS>>"
bitsadmin /util /getieproxy localsystem

Stap 5: Controle en probleemoplossing

Controleer instellingen:

netsh winhttp show proxy
Get-ItemProperty "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" | Select ProxyEnable, ProxyServer, ProxyOverride

Als Windows Update niet via de proxy werkt, zet AutoDetect uit en gebruik in Server Core-omgevingen de advproxy-methode.


Proxy-instellingen resetten

Gebruikersniveau (WinINET)

Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name ProxyEnable -Value 0
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name ProxyServer -ErrorAction SilentlyContinue
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name ProxyOverride -ErrorAction SilentlyContinue

Systeemniveau (WinHTTP / advproxy)

netsh winhttp reset proxy

Of voor de nieuwe methode (Server 2022 en later):

netsh winhttp set advproxy setting-scope=machine settings='{\"Proxy\":\"\",\"ProxyBypass\":\"\",\"AutoconfigUrl\":\"\",\"AutoDetect\":false}'

Samenvatting

Er zijn twee niveaus van proxyconfiguratie in Windows:

  • WinINET (gebruiker): beïnvloedt browsers en apps, gebonden aan gebruikerssessies.
  • WinHTTP / advproxy (systeem): beïnvloedt systeemdiensten zoals Windows Update en Defender.

Aanbevolen werkwijze voor beheer:

  1. Bepaal of het om gebruikers- of systeemcommunicatie gaat
  2. Stel de juiste methode in (WinINET of WinHTTP)
  3. Gebruik op Server Core advproxy
  4. Reset instellingen wanneer ze niet meer nodig zijn

Zo worden updates, BITS-overdrachten en Defender-downloads stabiel uitgevoerd, zelfs in netwerken met verplichte proxy’s.