主頁 > 知識(shí)庫 > Powershell小技巧之設(shè)置IE代理

Powershell小技巧之設(shè)置IE代理

熱門標(biāo)簽:電話機(jī)器人公司招聘 新鄭電銷機(jī)器人一個(gè)月多少錢 印臺(tái)區(qū)呼叫中心外呼系統(tǒng) 莫拉克電梯系統(tǒng)外呼怎么設(shè)置 六寸地圖標(biāo)注點(diǎn)怎么刪除 萬全縣地圖標(biāo)注app 地圖標(biāo)注的圖案 如何根據(jù)經(jīng)緯度百度地圖標(biāo)注 騰訊地圖標(biāo)注中心怎么標(biāo)注

IE的代理設(shè)置位于注冊表中:”HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings”下。關(guān)鍵鍵值為ProxyEnable和ProxyServer。所以通過更改注冊表即可完成IE代理的設(shè)置。

Function Set-IEProxy
{
 param(
 [bool]$Enable=$false,
 [string]$ProxyServer,
 [ValidateRange(1,65535)]
 [int]$port,
 [bool]$EnableAutoDetectSetting
 )
 
 #設(shè)置IE代理
 $proxyRegPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
 $enableProxy = Get-ItemProperty -Path $proxyRegPath -Name ProxyEnable
 if( -not $Enable) {
 Set-ItemProperty -path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name "ProxyEnable" -value 0
 Write-Host "IE代理已禁用。"
 }
 else {
 Set-ItemProperty -path $proxyRegPath -Name "ProxyEnable" -value 1
 Set-ItemProperty -path $proxyRegPath -Name "ProxyServer" -value ( $ProxyServer+":"+$port )
 Write-Host "IE代理已啟用"
 }
 
 #設(shè)置IE自動(dòng)檢測配置
 [byte[]]$bytes=$null
 if($EnableAutoDetectSetting){
  $bytes = [byte[]]@(70,0,0,0,38,0,0,0,9,0,0,0,10,0,0,0,50,46,49,46,49,46,51,58,51,51,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,172,18,32,72,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
 }
 else{
  $bytes = [byte[]]@(70,0,0,0,39,0,0,0,1,0,0,0,10,0,0,0,50,46,49,46,49,46,51,58,51,51,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,172,18,32,72,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
 }
 Set-ItemProperty -Path "$proxyRegPath\Connections" -Name DefaultConnectionSettings -Value $bytes
}


PS> Set-IEProxy -Enable $false
IE代理已禁用。 PS> Set-IEProxy -Enable $true -ProxyServer 2.1.1.3 -port 33 IE代理已啟用 PS> Set-IEProxy IE代理已禁用。 PS> Set-IEProxy -EnableAutoDetectSetting $true IE代理已禁用。 PS> Set-IEProxy -EnableAutoDetectSetting $false IE代理已禁用。

支持所有PS版本

您可能感興趣的文章:
  • PowerShell基本使用教程
  • PowerShell 指令操作集合(小結(jié))
  • 如何利用PowerShell監(jiān)控Win-Server性能詳解
  • PowerShell中Job相關(guān)命令及并行執(zhí)行任務(wù)詳解
  • PowerShell 腳本中的密碼保存的方法
  • PowerShell 遠(yuǎn)程執(zhí)行任務(wù)的方法步驟
  • 使用 powershell 創(chuàng)建虛擬機(jī)
  • 如何防范PowerShell代碼注入漏洞繞過受限語言模式
  • 自動(dòng)設(shè)置安卓手機(jī)wifi代理的PowerShell腳本

標(biāo)簽:疫苗接種 湘潭 南昌 喀什 臨汾 襄陽 天水 汕頭

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《Powershell小技巧之設(shè)置IE代理》,本文關(guān)鍵詞  Powershell,小,技巧,之,設(shè)置,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《Powershell小技巧之設(shè)置IE代理》相關(guān)的同類信息!
  • 本頁收集關(guān)于Powershell小技巧之設(shè)置IE代理的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章