![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Setting Proxy Server based on connected network I work on my laptop from work and home. At work I am inside the company intranet and browse internet through a Proxy Server. At home I use my own cable ISP. Is there a powershell script to do that? |
My System Specs![]() |
| | #2 (permalink) |
| | RE: Setting Proxy Server based on connected network Answering myself (a noob attempt): if ((Get-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings' -Name ProxyEnable | Select-Object ProxyEnable).ProxyEnable -eq 0) { Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings' -Name ProxyEnable -Value 1 Write-Host "Proxy Enabled." Get-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings' | Select-Object ProxyServer } else { Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings' -Name ProxyEnable -Value 0 Write-Host "Proxy Disabled." } if ((Get-Process -Name *iexplore*) -ne @()) { Write-Host "Stopping browsers." Stop-Process -Name iexplore -PassThru Write-Host "Restarting a browser." (New-Object -ComObject InternetExplorer.Application).Visible = $true } Start-Sleep -seconds 2 "Sandip" wrote: > I work on my laptop from work and home. At work I am inside the company > intranet and browse internet through a Proxy Server. At home I use my own > cable ISP. Is there a powershell script to do that? > |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Setting Proxy Server based on connected network You might find this a little easier to use: (get-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings').ProxyEnable "Sandip" <Sandip@discussions.microsoft.com> wrote in message news:3121C6FE-9FE0-4564-AA1A-306E1468A763@microsoft.com... > Answering myself (a noob attempt): > > if ((Get-ItemProperty -Path > 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings' -Name > ProxyEnable | Select-Object ProxyEnable).ProxyEnable -eq 0) > { > Set-ItemProperty -Path > 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings' -Name > ProxyEnable -Value 1 > Write-Host "Proxy Enabled." > Get-ItemProperty -Path > 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings' | > Select-Object ProxyServer > } > else > { > Set-ItemProperty -Path > 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings' -Name > ProxyEnable -Value 0 > Write-Host "Proxy Disabled." > } > if ((Get-Process -Name *iexplore*) -ne @()) > { > Write-Host "Stopping browsers." > Stop-Process -Name iexplore -PassThru > Write-Host "Restarting a browser." > (New-Object -ComObject InternetExplorer.Application).Visible = $true > } > Start-Sleep -seconds 2 > > "Sandip" wrote: > >> I work on my laptop from work and home. At work I am inside the company >> intranet and browse internet through a Proxy Server. At home I use my own >> cable ISP. Is there a powershell script to do that? >> -- Jeffrey Snover [MSFT] Windows PowerShell Architect Microsoft Corporation This posting is provided "AS IS" with no warranties, no confers rights. Visit the Windows PowerShell Team blog at: http://blogs.msdn.com/PowerShell Visit the Windows PowerShell ScriptCenter at: http://www.microsoft.com/technet/scr.../hubs/msh.mspx |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Very, very slow printing to network (server based) printer | Vista print fax & scan | |||
| Re: Very, very slow printing to network (server based) printer | Vista networking & sharing | |||
| Attempt to Network Vista Home on Domain Based Network (W2K -Server | Vista networking & sharing | |||
| SMTP server setting in network connection properties | Vista networking & sharing | |||