使用Powershell使用IE代理

公司的网络限制策略就像计划生育的政策一样...每次手动修改IE代理真让人烦燥
(192.168.75.80:808是代理地址)

存为proxy.ps1放入windows目录下,在cmd运行之,如果没有启动,运行脚本启用,反之关闭.爽

Code
$enableProxy=Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name ProxyEnable
if($enableProxy.ProxyEnable -eq 1)
{
    Write
-Host "IE proxy is disabled"
    Set
-ItemProperty -path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name "ProxyEnable" -value 0
}
else
{
    Write
-Host "IE proxy is enabled"
    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 "192.168.75.80:808"
}

 

 

posted on 2009-04-30 11:28  Haozes  阅读(1224)  评论(0编辑  收藏  举报