Skip to content
Franck SALLET edited this page Sep 5, 2026 · 1 revision

Proxy

WinHTTP/WinINET proxy configuration read, set, remove, and connectivity test.

4 function(s) in Public/proxy/.

Functions

Reference

Get-ProxyConfiguration

Retrieves proxy configuration from all three Windows proxy layers.

Queries proxy settings from three distinct sources:

  • WinINET (Internet Settings registry): used by browsers and .NET apps
  • WinHTTP (netsh winhttp): used by system services and PowerShell
  • Environment variables (HTTP_PROXY, HTTPS_PROXY, NO_PROXY)

Returns a single object consolidating all three layers for quick diagnosis of proxy misconfigurations.

Syntax

Get-ProxyConfiguration

Examples

Get-ProxyConfiguration

Returns the current proxy configuration from all three layers on the local machine.

Get-ProxyConfiguration -Verbose

Returns proxy configuration with verbose output showing each layer being queried.

Get-ProxyConfiguration | Select-Object -Property WinInet*, WinHttp*

Returns only WinINET and WinHTTP proxy settings, excluding environment variables.

Output: PSWinOps.ProxyConfiguration

Current proxy settings from system and user scopes.


Remove-ProxyConfiguration

Removes proxy configuration from one or more Windows proxy layers.

Disables and clears proxy settings from one or more of the three Windows proxy layers:

  • WinINET (HKCU registry): disables proxy, removes server, bypass list, and PAC URL
  • WinHTTP (netsh winhttp): resets to direct access
  • Environment variables: clears HTTP_PROXY, HTTPS_PROXY, NO_PROXY

Each layer can be targeted independently via the -Scope parameter. WinHTTP scope requires administrator privileges (netsh winhttp reset proxy).

Syntax

Remove-ProxyConfiguration [-Scope <string[]>]

Examples

Remove-ProxyConfiguration

Removes proxy configuration from all three layers.

Remove-ProxyConfiguration -Scope WinINET

Removes only WinINET (browser) proxy settings.

Remove-ProxyConfiguration -Scope WinINET, Environment -WhatIf

Shows what changes would be made without applying them.

Remove-ProxyConfiguration -Scope Environment -Confirm:$false

Clears proxy environment variables without confirmation prompt.


Set-ProxyConfiguration

Configures proxy settings on one or more Windows proxy layers.

Applies proxy configuration to one or more of the three Windows proxy layers:

  • WinINET (HKCU registry): used by browsers, .NET apps, Internet Explorer/Edge
  • WinHTTP (netsh winhttp): used by system services and PowerShell default proxy
  • Environment variables (HTTP_PROXY, HTTPS_PROXY, NO_PROXY)

Each layer can be targeted independently via the -Scope parameter. WinHTTP scope requires administrator privileges (netsh winhttp set proxy). Environment variables are set at the User level (persistent across sessions).

Syntax

Set-ProxyConfiguration [-ProxyServer <string>] [-BypassList <string>] [-AutoConfigURL <string>] [-Scope <string[]>]

Examples

Set-ProxyConfiguration -ProxyServer 'proxy.example.com:8080'

Configures all three proxy layers with the specified proxy server.

Set-ProxyConfiguration -ProxyServer 'proxy.example.com:8080' -BypassList '*.local;*.example.com;<local>' -Scope WinINET

Configures only WinINET (browser/IE) proxy with a bypass list.

Set-ProxyConfiguration -ProxyServer 'proxy.example.com:8080' -Scope WinINET, Environment -WhatIf

Shows what changes would be made to WinINET and environment variables without applying them.

Set-ProxyConfiguration -AutoConfigURL 'http://wpad.example.com/proxy.pac' -Scope WinINET

Configures WinINET to use a PAC auto-configuration URL (no static proxy).


Test-ProxyConnection

Tests connectivity through a proxy server.

Sends an HTTP request through the configured or specified proxy to verify that proxy connectivity is working. Returns a result object with success status, HTTP status code, response time, and proxy details.

By default, uses the system proxy (WinINET/WinHTTP). Use -ProxyServer to test a specific proxy.

Syntax

Test-ProxyConnection [-Uri <string>] [-ProxyServer <string>] [-TimeoutSec <int>]

Examples

Test-ProxyConnection

Tests connectivity through the system proxy using the default Microsoft connectivity test URL.

Test-ProxyConnection -ProxyServer 'proxy.example.com:8080'

Tests connectivity through a specific proxy server.

Test-ProxyConnection -Uri 'https://www.google.com' -ProxyServer 'proxy.example.com:8080' -TimeoutSec 5

Tests connectivity to Google through a specific proxy with a 5-second timeout.

Output: PSWinOps.ProxyTestResult

Proxy connectivity test result with latency and status code.


PSWinOps Wiki

Home

Domains

Clone this wiki locally