Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

How to Configure HTTP Proxy Settings Using Set-WinHttpProxy in PowerShell

In today's networked environments, configuring HTTP proxy settings is essential for managing and securing web traffic. For systems running on Windows, PowerShell offers a powerful way to automate these configurations using the Set-WinHttpProxy cmdlet. This article will guide you through the process of using Set-WinHttpProxy to set up and manage HTTP proxy settings in a Windows environment. We will provide practical examples to help you understand how to implement these configurations effectively.

Examples:

  1. Setting a Simple HTTP Proxy: To configure a basic HTTP proxy, you can use the following PowerShell script:

    # Define the proxy server address and port
    $proxyServer = "proxy.example.com:8080"
    
    # Set the WinHTTP proxy
    Set-WinHttpProxy -ProxyServer $proxyServer

    This script sets the HTTP proxy to proxy.example.com on port 8080.

  2. Setting a Proxy with Bypass List: If you need to bypass the proxy for certain addresses, you can specify a bypass list:

    # Define the proxy server address and port
    $proxyServer = "proxy.example.com:8080"
    
    # Define the bypass list (addresses that should not use the proxy)
    $bypassList = "localhost;*.example.com"
    
    # Set the WinHTTP proxy with a bypass list
    Set-WinHttpProxy -ProxyServer $proxyServer -ProxyBypass $bypassList

    This script configures the proxy server and specifies that traffic to localhost and any subdomains of example.com should bypass the proxy.

  3. Clearing the Proxy Settings: To remove any previously set proxy configurations, you can clear the proxy settings:

    # Clear the WinHTTP proxy settings
    Set-WinHttpProxy -ProxyServer " "

    This script effectively removes any proxy settings by setting the proxy server to an empty string.

  4. Viewing Current Proxy Settings: To check the current proxy settings, you can use the netsh command:

    # Display current WinHTTP proxy settings
    netsh winhttp show proxy

    This command will output the current proxy configuration, allowing you to verify your settings.

To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.