はじめに
Windowsサーバーで作業する際に、「プロキシサーバーを使う」がオンの状態で実施する作業があるのですが、作業中にほかの人にオフにされて煩わしいので作った。結局怖くて使ってない。
きっと誰の役にも立たない。作ってる時も特にハマることはなかった。
中身
proxy.ps1
$regPath = "Registry::HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings"
while($true){
$ProxyEnable = (Get-Item -Path $regPath).GetValue("ProxyEnable")
if($ProxyEnable -eq 0){
echo $ProxyEnable
Set-ItemProperty -Path $regPath -name ProxyEnable -Value 1
}else{
echo $ProxyEnable
}
Start-Sleep -s 1
}
おわりに
powershellでレジストリいじったことなかったから勉強にはなりました。