Created
April 20, 2014 09:40
-
-
Save hybridjosto/11109859 to your computer and use it in GitHub Desktop.
change outlook Registry settings in python
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
import _winreg | |
outlook_security = _winreg.OpenKey( | |
_winreg.HKEY_CURRENT_USER, | |
"Software\\Policies\\Microsoft\\office\\12.0\\Outlook\\Security" | |
) | |
settings = {'PromptOOMItemPropertyAccess':2, | |
'PromptOOMSend' : 2, | |
'PromptOOMAddressBookAccess' : 2, | |
'PromptOOMAddressInformationAccess' : 2, | |
'PromptOOMFormulaAccess' : 2, | |
'PromptOOMAddressUserPropertyFind' : 2, | |
'PromptSimpleMAPISend' : 2, | |
'PromptSimpleMAPIOpenMessage' : 2, | |
'PromptSimpleMAPINameResolve' : 2, | |
'AdminSecurityMode' : 3 | |
} | |
# list values owned by this registry key | |
def printKeys(): | |
try: | |
i = 0 | |
while 1: | |
name, value, type = _winreg.EnumValue(outlook_security, i) | |
print name,value | |
i += 1 | |
except WindowsError: | |
def setKeys(): | |
for outlook_key, key_value in settings.items(): | |
try: | |
_winreg.SetValueEx(outlook_security, outlook_key,0, _winreg.REG_DWORD, key_value) | |
except WindowsError as e: | |
print e.errno, e.strerror | |
if __name__ == '__main__': | |
setKeys() | |
# printKeys() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment