Last active
May 10, 2018 17:38
-
-
Save kapoorlakshya/71839d33d6e4938a191b91a55d2f225e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1 - 'Intranet' | |
# 2 - 'Trusted Sites' | |
# 3 - 'Internet' | |
# 4 - 'Restricted Sites | |
zones = [1, 2, 3, 4] | |
# @see https://superuser.com/questions/1031225/what-is-the-registry-setting-to-enable-protected-mode-in-a-specific-zone | |
mode = 0 # Enable | |
# mode = 3 # Disable | |
# Build path based on zone | |
reg_path = -> (z) { "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Zones\\#{z}" } | |
# @see https://ruby-doc.org/stdlib-1.9.3/libdoc/dl/rdoc/Win32/Registry.html | |
zones.each { |z| | |
Win32::Registry::HKEY_CURRENT_USER.open(reg_path.call(z), Win32::Registry::KEY_WRITE) do |reg| | |
reg.write_i('2500', mode) # Write entry as Integer | |
end | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment