[RESUELTO] Paquete para deshabilitar la migración al nuevo Outlook

Preguntas sobre paquetes WAPT / Solicitudes y ayuda sobre paquetes WAPT.
Reglas del foro
Reglas del foro de la comunidad
* Soporte en inglés en www.reddit.com/r/wapt
* El soporte de la comunidad en francés está disponible en este foro
* Por favor, anteponga [RESUELTO] al título del tema si está resuelto.
* Por favor, no edite un tema que esté etiquetado como [RESUELTO]. Abra un nuevo tema haciendo referencia al anterior.
* Especifique la versión de WAPT instalada, la versión completa y el número de compilación (2.2.1.11957 / 2.2.2.12337 / etc.), así como la edición Enterprise/Discovery.
* Las versiones 1.8.2 y anteriores ya no son compatibles. Las únicas preguntas aceptadas sobre la versión 1.8.2 están relacionadas con la actualización a una versión compatible (2.1, 2.2, etc.).
* Especifique el sistema operativo del servidor (Linux/Windows) y la versión (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Especifique el sistema operativo de la máquina de administración/creación de paquetes y de la máquina con el agente problemático, si corresponde (Windows 7/10/11/Debian 11/etc.).
* Evite hacer varias preguntas al abrir un tema, ya que podría ser ignorado. Si hay varios temas, ábralos por separado, preferiblemente uno tras otro y no todos a la vez (es decir, no sature el foro con spam).
* Incluya fragmentos de código, capturas de pantalla y otras imágenes directamente en la publicación. Los enlaces a Pastebin, Bitly y otros sitios de terceros serán eliminados sistemáticamente.
* Como en cualquier foro comunitario, el soporte es proporcionado voluntariamente por los miembros. Si necesita soporte comercial, puede comunicarse con el departamento de ventas de Tranquil IT al 02.40.97.57.55.
Respuesta
Bastien30
Mensajes: 38
Inscripción: 8 de marzo de 2024 - 15:21

26 de diciembre de 2024 - 17:16

Buen día,

EDIT 1: Corrección del valor de la tecla HideNewOutlookToggle (1 y no 0), error mío.
EDITAR 2: Las claves de registro se configuran para todos los usuarios en la función install() en lugar de durante session_setup() porque los usuarios que no son administradores no tienen derecho a escribir en HKEY_CURRENT_USER\Software\Policies\.
EDITAR 3: Reaplicación de la configuración de la clave de registro desde la auditoría si las claves son incorrectas o faltan para un usuario (caso de usuarios creados después de la instalación del paquete).

Aquí hay un paquete que le permite deshabilitar la migración al nuevo Outlook (consulte https://www.it-connect.fr/gpo-bloqueador-m ... l-outlook/).
También desinstala la aplicación si está instalada.

Por favor, déjame saber si te funciona bien :D

Código: Seleccionar todo

# -*- 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)
fdu
Mensajes: 1
Inscripción: 3 de enero de 2025 - 16:11

3 de enero de 2025 - 16:55

Hola,
A continuación se presentan algunas pequeñas modificaciones realizadas, para nuestro caso específico, con el apoyo de Bastien.
¡Y buena suerte el lunes! :D

---

Aclaración sobre las pruebas realizadas (paquete llamado disabled-newoutlook en nuestro sistema).
Probado en Windows Pro 10 22H2 y Windows Pro 11 23H2
Funciona en máquinas con múltiples sesiones de usuario
Y no revierta a los usuarios que ya han migrado al nuevo Outlook

No es necesario reiniciar las computadoras para que el cambio surta efecto, simplemente cierre y vuelva a abrir Outlook.

Código: Seleccionar todo

# -*- coding: utf-8 -*-
from setuphelpers import *

#source: https://learn.microsoft.com/en-us/microsoft-365-apps/outlook/get-started/control-install

# Disable new outlook migration
int_newoutlook_migration = 0
# Hide "Try new Outlook" button
int_newoutlook_button = 1

#Migration to New Outlook (default is disabled)
reg_newoutlook_migration = { "path" : r'Software\Policies\Microsoft\office\16.0\outlook\preferences', "name" : "NewOutlookMigrationUserSetting", "value" : int_newoutlook_migration, "type" : REG_DWORD }
# "Try new Outlook" button (default is hidden)
reg_newoutlook_button = { "path" : r'Software\Microsoft\Office\16.0\Outlook\Options\General', "name" : "HideNewOutlookToggle", "value" : int_newoutlook_button, "type" : REG_DWORD }


def install():
    # Remove new Outlook Appx if installed (computer environment)
    #remove_appx(r'Microsoft.OutlookForWindows')

    # Set registry values for all users
    for registry in [reg_newoutlook_migration, reg_newoutlook_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, registry["path"]), registry["name"], registry["value"], registry["type"])

def session_setup():
    pass
    # Remove new Outlook Appx if installed (user environment)
    #remove_user_appx(r'Microsoft.OutlookForWindows')

def audit():
    audit_result = "OK"
    # Check registry values for all users if exists
    for registry in [reg_newoutlook_migration, reg_newoutlook_button]:
        for user_sid in get_all_users_sids():
            if reg_value_exists(HKEY_USERS, r'%s\%s' % (user_sid, registry["path"]), registry["name"]):
                if registry_readstring(HKEY_USERS, r'%s\%s' % (user_sid, registry["path"]), registry["name"]) != str(registry["value"]):
                    print(r'Registry value "%s" is wrong for user "%s"' % (registry["name"], get_user_from_sid(user_sid)))
                    audit_result = "ERROR"
    return audit_result

def uninstall():
    #Enable
    # Force new outlook migration
    #int_newoutlook_migration = 1
    # Show "Try new Outlook" button
    int_newoutlook_button = 0

    #Force to New Outlook
    #reg_newoutlook_migration = { "path" : r'Software\Policies\Microsoft\office\16.0\outlook\preferences', "name" : "NewOutlookMigrationUserSetting", "value" : int_newoutlook_migration, "type" : REG_DWORD }
    # "Try new Outlook" button
    reg_newoutlook_button = { "path" : r'Software\Microsoft\Office\16.0\Outlook\Options\General', "name" : "HideNewOutlookToggle", "value" : int_newoutlook_button, "type" : REG_DWORD }

    # Set registry values for all users
    for registry in [reg_newoutlook_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, registry["path"]), registry["name"], registry["value"], registry["type"])

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)
Respuesta