PowerShell implements automatic IE proxy settings

Source: Internet
Author: User

#IE代理设置函数
# $proxy _enable (0: Disable IE Proxy 1: enable IE proxy)
# $proxy _server (192.168.1.111:8080)
Function F_set_proxy ([string] $proxy _enable,[string] $proxy _server)
{
#是否启动IE代理
if ($proxy _enable-eq "0")
{
#禁用IE代理
Set-itemproperty-path "Hkcu:\software\microsoft\windows\currentversion\internet Settings"-Name "ProxyEnable"- Value 0
}
Else
{
#启用IE代理
Set-itemproperty-path "Hkcu:\software\microsoft\windows\currentversion\internet Settings"-Name "ProxyEnable"- Value 1
}
#设置IE代理的ip和端口
Set-itemproperty-path "Hkcu:\software\microsoft\windows\currentversion\internet Settings"-Name "ProxyServer"- Value $proxy _server
}


#保存脚本运行前的IE代理的设置状态
#保存脚本运行前的IE代理是否可用
$proxy _enable_backup=get-itemproperty-path "Hkcu:\software\microsoft\windows\currentversion\internet Settings"- Name proxyenable
#保存脚本运行前的IE代理的ip和端口
$proxy _server_backup=get-itemproperty-path "Hkcu:\software\microsoft\windows\currentversion\internet Settings"- Name ProxyServer


#设置当前脚本使用的IE代理
F_set_proxy "1" "192.168.1.111:8080"

#还原到脚本运行前的IE代理的设置
F_set_proxy $proxy _enable_backup. ProxyEnable $proxy _server_backup. ProxyServer

PowerShell implements automatic IE proxy settings

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.