M
Mradr
Not sure - but my code work a while back with no problems. It seems after a while MS changes something and I am unable to lock down the proxy like before. Anyways, I need to be able to gray out the proxy settings for both limit and administrator accounts. In the registry I set the following and loop over all current users to set the proxy settings. In some cases this works with no problem. It's gray out and works like it should. In others - it'll allow users to turn it off and on.
if proxysetting == "1":
if user_only == 0:
runcommand(r'reg.exe ADD "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v MigrateProxy /t REG_DWORD /d 1 /f')
runcommand(r'reg.exe ADD "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f')
runcommand(r'reg.exe ADD "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /t REG_SZ /d %s /f' % proxyipaddress)
runcommand(r'reg.exe ADD "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v proxyoverride /t REG_SZ /d "%s;*pclocker.ctgroup.tech" /f' % website_whitelist)
runcommand(r'reg.exe ADD "HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v MigrateProxy /t REG_DWORD /d 1 /f')
runcommand(r'reg.exe ADD "HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f')
runcommand(r'reg.exe ADD "HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /t REG_SZ /d %s /f' % proxyipaddress)
runcommand(r'reg.exe ADD "HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyOverride /t REG_SZ /d "%s;*pclocker.ctgroup.tech" /f' % website_whitelist)
runcommand(r'reg.exe ADD "%s\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v MigrateProxy /t REG_DWORD /d 1 /f' % reg_path)
runcommand(r'reg.exe ADD "%s\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f' % reg_path)
runcommand(r'reg.exe ADD "%s\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /t REG_SZ /d %s /f' % (reg_path, proxyipaddress))
runcommand(r'reg.exe ADD "%s\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v proxyoverride /t REG_SZ /d "%s;*pclocker.ctgroup.tech" /f' % (reg_path, website_whitelist))
runcommand(r'reg.exe ADD "%s\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v MigrateProxy /t REG_DWORD /d 1 /f' % reg_path)
runcommand(r'reg.exe ADD "%s\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f' % reg_path)
runcommand(r'reg.exe ADD "%s\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /t REG_SZ /d %s /f' % (reg_path, proxyipaddress))
runcommand(r'reg.exe ADD "%s\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyOverride /t REG_SZ /d "%s;*pclocker.ctgroup.tech" /f' % (reg_path, website_whitelist))
runcommand(r'reg.exe ADD "HKLM\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxySettingsPerUser /t REG_DWORD /d 1 /f')
runcommand(r'reg.exe ADD "%s\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxySettingsPerUser /t REG_DWORD /d 1 /f' % reg_path)
I also tried this setting it only with HKLM - but the problem there is that it pulls old HKLM settings even after cleaning out all registry keys with the old information both on the user and machine. It seems like something really mess up on Windows when it comes to correctly setting what you want in there. This has been going on for a while and I been able to so far fix it by changing out different settings here and there to make it work - but at this point it's getting a bit silly and I like to have a solution for this so I can lock down all the devices I handle.
if self.ProxySetting == "1":
runcommand(r'reg.exe ADD "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v MigrateProxy /t REG_DWORD /d 1 /f')
runcommand(r'reg.exe ADD "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f')
runcommand(r'reg.exe ADD "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /t REG_SZ /d %s /f' % self.proxyipaddress)
runcommand(r'reg.exe ADD "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v proxyoverride /t REG_SZ /d "%s;*pclocker.ctgroup.tech;*precomputer.hostedrmm.com;*pcsrt.com" /f' % self.Website_WhiteList)
runcommand(r'reg.exe ADD "HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v MigrateProxy /t REG_DWORD /d 1 /f')
runcommand(r'reg.exe ADD "HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f')
runcommand(r'reg.exe ADD "HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /t REG_SZ /d %s /f' % self.proxyipaddress)
runcommand(r'reg.exe ADD "HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyOverride /t REG_SZ /d "%s;*pclocker.ctgroup.tech;*precomputer.hostedrmm.com;*pcsrt.com" /f' % self.Website_WhiteList)
runcommand(r'reg.exe ADD "HKLM\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxySettingsPerUser /t REG_DWORD /d 0 /f')
I clear out the proxy settings using the following:
runcommand(r'reg.exe DELETE "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v MigrateProxy /f')
runcommand(r'reg.exe DELETE "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /f')
runcommand(r'reg.exe DELETE "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /f')
runcommand(r'reg.exe DELETE "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v proxyoverride /f')
runcommand(r'reg.exe DELETE "HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v MigrateProxy /f')
runcommand(r'reg.exe DELETE "HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /f')
runcommand(r'reg.exe DELETE "HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /f')
runcommand(r'reg.exe DELETE "HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v proxyoverride /f')
runcommand(r'reg.exe DELETE "HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v AutoConfigURL /f')
runcommand(r'reg.exe ADD "HKLM\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxySettingsPerUser /t REG_DWORD /d 1 /f')
runcommand(r'reg.exe DELETE "%s\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v MigrateProxy /f' % self.Reg_Path)
runcommand(r'reg.exe DELETE "%s\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /f' % self.Reg_Path)
runcommand(r'reg.exe DELETE "%s\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /f' % self.Reg_Path)
runcommand(r'reg.exe DELETE "%s\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v proxyoverride /f' % self.Reg_Path)
runcommand(r'reg.exe DELETE "%s\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v MigrateProxy /f' % self.Reg_Path)
runcommand(r'reg.exe DELETE "%s\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /f' % self.Reg_Path)
runcommand(r'reg.exe DELETE "%s\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /f' % self.Reg_Path)
runcommand(r'reg.exe DELETE "%s\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v proxyoverride /f' % self.Reg_Path)
runcommand(r'reg.exe DELETE "%s\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v AutoConfigURL /f' % self.Reg_Path)
runcommand(r'reg.exe ADD "%s\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxySettingsPerUser /t REG_DWORD /d 1 /f' % self.Reg_Path)
I have a mix of windows 10 1809 and 1803 devices all with mix results.
Continue reading...
if proxysetting == "1":
if user_only == 0:
runcommand(r'reg.exe ADD "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v MigrateProxy /t REG_DWORD /d 1 /f')
runcommand(r'reg.exe ADD "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f')
runcommand(r'reg.exe ADD "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /t REG_SZ /d %s /f' % proxyipaddress)
runcommand(r'reg.exe ADD "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v proxyoverride /t REG_SZ /d "%s;*pclocker.ctgroup.tech" /f' % website_whitelist)
runcommand(r'reg.exe ADD "HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v MigrateProxy /t REG_DWORD /d 1 /f')
runcommand(r'reg.exe ADD "HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f')
runcommand(r'reg.exe ADD "HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /t REG_SZ /d %s /f' % proxyipaddress)
runcommand(r'reg.exe ADD "HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyOverride /t REG_SZ /d "%s;*pclocker.ctgroup.tech" /f' % website_whitelist)
runcommand(r'reg.exe ADD "%s\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v MigrateProxy /t REG_DWORD /d 1 /f' % reg_path)
runcommand(r'reg.exe ADD "%s\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f' % reg_path)
runcommand(r'reg.exe ADD "%s\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /t REG_SZ /d %s /f' % (reg_path, proxyipaddress))
runcommand(r'reg.exe ADD "%s\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v proxyoverride /t REG_SZ /d "%s;*pclocker.ctgroup.tech" /f' % (reg_path, website_whitelist))
runcommand(r'reg.exe ADD "%s\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v MigrateProxy /t REG_DWORD /d 1 /f' % reg_path)
runcommand(r'reg.exe ADD "%s\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f' % reg_path)
runcommand(r'reg.exe ADD "%s\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /t REG_SZ /d %s /f' % (reg_path, proxyipaddress))
runcommand(r'reg.exe ADD "%s\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyOverride /t REG_SZ /d "%s;*pclocker.ctgroup.tech" /f' % (reg_path, website_whitelist))
runcommand(r'reg.exe ADD "HKLM\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxySettingsPerUser /t REG_DWORD /d 1 /f')
runcommand(r'reg.exe ADD "%s\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxySettingsPerUser /t REG_DWORD /d 1 /f' % reg_path)
I also tried this setting it only with HKLM - but the problem there is that it pulls old HKLM settings even after cleaning out all registry keys with the old information both on the user and machine. It seems like something really mess up on Windows when it comes to correctly setting what you want in there. This has been going on for a while and I been able to so far fix it by changing out different settings here and there to make it work - but at this point it's getting a bit silly and I like to have a solution for this so I can lock down all the devices I handle.
if self.ProxySetting == "1":
runcommand(r'reg.exe ADD "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v MigrateProxy /t REG_DWORD /d 1 /f')
runcommand(r'reg.exe ADD "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f')
runcommand(r'reg.exe ADD "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /t REG_SZ /d %s /f' % self.proxyipaddress)
runcommand(r'reg.exe ADD "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v proxyoverride /t REG_SZ /d "%s;*pclocker.ctgroup.tech;*precomputer.hostedrmm.com;*pcsrt.com" /f' % self.Website_WhiteList)
runcommand(r'reg.exe ADD "HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v MigrateProxy /t REG_DWORD /d 1 /f')
runcommand(r'reg.exe ADD "HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f')
runcommand(r'reg.exe ADD "HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /t REG_SZ /d %s /f' % self.proxyipaddress)
runcommand(r'reg.exe ADD "HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyOverride /t REG_SZ /d "%s;*pclocker.ctgroup.tech;*precomputer.hostedrmm.com;*pcsrt.com" /f' % self.Website_WhiteList)
runcommand(r'reg.exe ADD "HKLM\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxySettingsPerUser /t REG_DWORD /d 0 /f')
I clear out the proxy settings using the following:
runcommand(r'reg.exe DELETE "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v MigrateProxy /f')
runcommand(r'reg.exe DELETE "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /f')
runcommand(r'reg.exe DELETE "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /f')
runcommand(r'reg.exe DELETE "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v proxyoverride /f')
runcommand(r'reg.exe DELETE "HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v MigrateProxy /f')
runcommand(r'reg.exe DELETE "HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /f')
runcommand(r'reg.exe DELETE "HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /f')
runcommand(r'reg.exe DELETE "HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v proxyoverride /f')
runcommand(r'reg.exe DELETE "HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v AutoConfigURL /f')
runcommand(r'reg.exe ADD "HKLM\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxySettingsPerUser /t REG_DWORD /d 1 /f')
runcommand(r'reg.exe DELETE "%s\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v MigrateProxy /f' % self.Reg_Path)
runcommand(r'reg.exe DELETE "%s\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /f' % self.Reg_Path)
runcommand(r'reg.exe DELETE "%s\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /f' % self.Reg_Path)
runcommand(r'reg.exe DELETE "%s\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v proxyoverride /f' % self.Reg_Path)
runcommand(r'reg.exe DELETE "%s\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v MigrateProxy /f' % self.Reg_Path)
runcommand(r'reg.exe DELETE "%s\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /f' % self.Reg_Path)
runcommand(r'reg.exe DELETE "%s\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /f' % self.Reg_Path)
runcommand(r'reg.exe DELETE "%s\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v proxyoverride /f' % self.Reg_Path)
runcommand(r'reg.exe DELETE "%s\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v AutoConfigURL /f' % self.Reg_Path)
runcommand(r'reg.exe ADD "%s\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxySettingsPerUser /t REG_DWORD /d 1 /f' % self.Reg_Path)
I have a mix of windows 10 1809 and 1803 devices all with mix results.
Continue reading...