EDIT 1: Korrektur des Wertes des Schlüssels HideNewOutlookToggle (1 und nicht 0), mein Fehler.
EDIT 2: Die Registrierungsschlüssel werden für alle Benutzer in der install()-Funktion und nicht während session_setup() konfiguriert, da Benutzer ohne Administratorrechte nicht das Recht haben, in HKEY_CURRENT_USER\Software\Policies\ zu schreiben.
EDIT 3: Erneute Anwendung der Registry-Schlüsselkonfiguration aus dem Audit, falls Schlüssel für einen Benutzer fehlerhaft oder nicht vorhanden sind (Fall von Benutzern, die nach der Paketinstallation erstellt wurden).
Hier ist ein Paket, mit dem Sie die Migration zum neuen Outlook deaktivieren können (siehe https://www.it-connect.fr/gpo-bloquer-m ... l-outlook/).
Außerdem wird die Anwendung deinstalliert, falls sie installiert ist.
Bitte lassen Sie mich wissen, ob es für Sie gut funktioniert
Code: Alle auswählen
# -*- coding: utf-8 -*-
from setuphelpers import *
# https://learn.microsoft.com/en-us/microsoft-365-apps/outlook/get-started/control-install
# Disable new outlook migration
new_outlook_migration = { "path" : r'Software\Policies\Microsoft\office\16.0\outlook\preferences', "name" : "NewOutlookMigrationUserSetting", "value" : 0 }
# Hide "Try new Outlook" button
new_outlook_button = { "path" : r'Software\Microsoft\Office\16.0\Outlook\Options\General', "name" : "HideNewOutlookToggle", "value" : 1 }
def install():
# Remove new Outlook Appx if installed (computer environment)
remove_appx(r'Microsoft.OutlookForWindows')
# Set registry values for all users
set_registry_all_users()
def session_setup():
# Remove new Outlook Appx if installed (user environment)
remove_user_appx(r'Microsoft.OutlookForWindows')
def audit():
audit_result = "OK"
need_reapply = False
# Check registry values for all users if exists
for i in [new_outlook_migration, new_outlook_button]:
for user_sid in get_all_users_sids():
if reg_key_exists(HKEY_USERS, user_sid):
if reg_value_exists(HKEY_USERS, r'%s\%s' % (user_sid, i["path"]), i["name"]):
if registry_readstring(HKEY_USERS, r'%s\%s' % (user_sid, i["path"]), i["name"]) != str(i["value"]):
print(r'Registry value "%s" is wrong for user "%s", reapplying...' % (i["name"], get_user_from_sid(user_sid)))
need_reapply = True
else:
print(r'Registry value "%s" is missing for user "%s", reapplying...' % (i["name"], get_user_from_sid(user_sid)))
need_reapply = True
if need_reapply:
set_registry_all_users()
audit_result = "WARNING"
return audit_result
def uninstall():
# Remove registry values for all users if exists
for i in [new_outlook_migration, new_outlook_button]:
for user_sid in get_all_users_sids():
if reg_value_exists(HKEY_USERS, r'%s\%s' % (user_sid, i["path"]), i["name"]):
registry_delete(HKEY_USERS, r'%s\%s' % (user_sid, i["path"]), i["name"])
def set_registry_all_users():
for i in [new_outlook_migration, new_outlook_button]:
for user_sid in get_all_users_sids():
if reg_key_exists(HKEY_USERS, user_sid):
registry_set(HKEY_USERS, r'%s\%s' % (user_sid, i["path"]), i["name"], i["value"], REG_DWORD)
def get_all_users_sids():
user_sids = []
with reg_openkey_noredir(HKEY_LOCAL_MACHINE, r'SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList') as sids:
for sid in reg_enum_subkeys(sids):
# Exclude system users SIDs
if sid.startswith("S-1-5-21-"):
user_sids.append(sid)
# Return all users SIDs as list
return ensure_list(user_sids)
