One of my friend wanted a small Proxy settings hack tool which I created using Powershell script, it is very small tool and helps to change proxy server settings, It can changed when Internet Options >> Connections tab is either missing or Lan settings button is disabled, and you still want to change proxy settings. Basically this graphical powershell script make changes in the Registry. So registry modification must be enabled for this.
After launching script looks like below. It shows the current proxy configuration, Settings can be changed via typing new proxy server and proxy port and pressing Change Proxy button. Once Setting is refreshed, you can see the results. To build this GUI, I have used Powershell Studio.
Basically this script Enable or Disable and changes proxy server dword values under registry path HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings . Below dword values need to change the behavior of Lan settings >> proxy.
ProxyEnable = 1 #1 = enabled & 0 = DisabledProxyServer = 'OldProxyServer:808'
This script can be downloaded from here, It is also available on github.com.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
.NOTES
--------------------------------------------------------------------------------
Code generated by: Visual Studio 2015
Created on: 4/19/2018 4:57 AM
Generated by: http://vcloud-lab.com
Written by: Kunal Udapi
Tested on: Windows 10
Windows 2016 Server
--------------------------------------------------------------------------------
.DESCRIPTION
GUI script generated using Visual Studio 2015
#>
Add-Type -AssemblyName PresentationFramework
$RawXamlForm = @"
Title="Configure Proxy Server" Height="201" Width="525" ResizeMode="NoResize" Topmost="True" WindowStyle="none">
"@
$RawXamlForm = $RawXamlForm -replace 'x:' , ''
[xml] $XamlForm = $RawXamlForm
$XMLReader = (New-Object System.Xml.XmlNodeReader $XamlForm )
$ChangeProxyForm = [Windows.Markup.XamlReader] :: Load($XMLReader )
$XamlForm .SelectNodes("//*[@Name]" ) | Foreach -Object {Set-Variable -Name ($_ .Name) -Value $ChangeProxyForm .FindName($_ .Name)}
#'HKEY_USERS\S-1-5-21-3215338630-3058045017-314744653-1000\Software\Microsoft\Windows\CurrentVersion\Internet Settings'
#'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings'
#'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings'
function Disable-Change {
$ChangeProxyServer .IsReadOnly = $true
$ChangeProxyPort .IsReadOnly = $true
$ChangeProxyB .IsEnabled = $false
$EnableProxy .IsEnabled = $false
}
function Enable-Change {
$ChangeProxyServer .IsReadOnly = $false
$ChangeProxyPort .IsReadOnly = $false
$ChangeProxyB .IsEnabled = $true
$EnableProxy .IsEnabled = $true
}
function Get-CurrentProxyInfo {
try {
$Script:CurrentInternetProxyInfo = Get-ItemProperty -Path $RegKey -ErrorAction Stop
$CurrentProxyInfo = $Script:CurrentInternetProxyInfo .ProxyServer -split ':'
Switch ($Script:CurrentInternetProxyInfo .ProxyEnable) {
0 {$CProxyStatusLabel .Content = 'Proxy is Disabled' }
1 {$CProxyStatusLabel .Content = 'Proxy is Enabled' }
default {$CProxyStatusLabel .Content = 'Unknown Setting' }
}
$CProxyServerBox .Text = $CurrentProxyInfo [0]
$CProxyPortBox .Text = $CurrentProxyInfo [1]
Enable-Change
}
catch {
$CProxyServerBox .Text = "You don't have permissions to read registry"
Disable-Change
}
}
Function Set-NewProxyConfiguration {
if ($ChangeProxyPort .Text -match '\d' -and $ChangeProxyServer .Text -ne 'Type Valid Proxy server and Port no' ) {
try {
Switch ($EnableProxy .IsChecked) {
True {Set-ItemProperty -Path $RegKey -Name ProxyEnable -Value 1 -ErrorAction Stop}
False {Set-ItemProperty -Path $RegKey -Name ProxyEnable -Value 0 -ErrorAction Stop}
}
$NewProxy = "{0}:{1}" -f $ChangeProxyServer .Text, $ChangeProxyPort .Text
Set-ItemProperty -Path $RegKey -Name ProxyServer -Value $NewProxy -ErrorAction Stop
}
catch {
$ChangeProxyServer .Text = "You don't have permissions to read registry"
Disable-Change
}
}
Get-CurrentProxyInfo
}
Try {
$Path = Split-Path $MyInvocation .MyCommand.Path -Parent -ErrorAction Stop
$LogoImage .Source = "$Path\Proxy_Change.png"
}
Catch {
}
$RegKey = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings'
$UrlLabel .Add_MouseDoubleClick({[system.Diagnostics.Process] :: start('http://vcloud-lab.com' )})
$CloseB .Add_Click({$ChangeProxyForm .Close()})
$RefreshB .Add_Click({Get-CurrentProxyInfo })
Get-CurrentProxyInfo
$ChangeProxyB .Add_Click({Set-NewProxyConfiguration })
$ChangeProxyForm .Add_MouseDown({$ChangeProxyForm .DragMove()})
[void] $ChangeProxyForm .ShowDialog()
#ProxyEnable = 1 #1 = enabled & 0 = Disabled
#ProxyServer = 'OldProxyServer:808'
Useful Tools COOL POWERSHELL FREE ONLINE GUI GENERATOR TOOL, POSHGUI Generate random password GUI using powershell Part 1: Create WPF XAML powershell GUI form with Visual studio Powershell PoshGUI: Convert user to SID and vice versa using