-
Notifications
You must be signed in to change notification settings - Fork 0
Proxy
WinHTTP/WinINET proxy configuration read, set, remove, and connectivity test.
4 function(s) in Public/proxy/.
-
Get-ProxyConfiguration— Retrieves proxy configuration from all three Windows proxy layers -
Remove-ProxyConfiguration— Removes proxy configuration from one or more Windows proxy layers -
Set-ProxyConfiguration— Configures proxy settings on one or more Windows proxy layers -
Test-ProxyConnection— Tests connectivity through a proxy server
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-ProxyConfigurationExamples
Get-ProxyConfigurationReturns the current proxy configuration from all three layers on the local machine.
Get-ProxyConfiguration -VerboseReturns 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.
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-ProxyConfigurationRemoves proxy configuration from all three layers.
Remove-ProxyConfiguration -Scope WinINETRemoves only WinINET (browser) proxy settings.
Remove-ProxyConfiguration -Scope WinINET, Environment -WhatIfShows what changes would be made without applying them.
Remove-ProxyConfiguration -Scope Environment -Confirm:$falseClears proxy environment variables without confirmation prompt.
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 WinINETConfigures only WinINET (browser/IE) proxy with a bypass list.
Set-ProxyConfiguration -ProxyServer 'proxy.example.com:8080' -Scope WinINET, Environment -WhatIfShows what changes would be made to WinINET and environment variables without applying them.
Set-ProxyConfiguration -AutoConfigURL 'http://wpad.example.com/proxy.pac' -Scope WinINETConfigures WinINET to use a PAC auto-configuration URL (no static proxy).
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-ProxyConnectionTests 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 5Tests connectivity to Google through a specific proxy with a 5-second timeout.
Output: PSWinOps.ProxyTestResult
Proxy connectivity test result with latency and status code.
Domains
- Active Directory (22)
- Certificate (1)
- Event Log (9)
- Health Check (16)
- IIS (9)
- Network (26)
- NTP (5)
- Proxy (4)
- RDP (6)
- Security (1)
- System (20)
- Utils (4)
- VSS (Shadow Copy) (6)
- Windows Update (10)