Page 1 sur 1

Re dell command update

Publié : 21 sept. 2023 - 09:53
par SeiyaGame
Bonjour,

Je me permets de revenir sur le topic précédent concernant ce paquet.

J'ai corrigé la fonction d'audit, une petite erreur d'indentation s'était glissée. Cette erreur faisait que l'audit affichait toujours un WARNING malgré une installation correcte du service.

Code : Tout sélectionner

def audit():
    audit_status = "OK"
    service_name = "DellClientManagementService"
    service_start_mode = get_service_start_mode(service_name)

    if service_start_mode in ["Disabled", "Manual"]:
        print(f"{service_name} service is stopped and prevents the application from working properly.")
        audit_status = "ERROR"
    elif not service_installed(service_name):
        print(f"{service_name} service does not exist.")
        audit_status = "ERROR"
    else:
        if service_is_running(service_name):
            print(f"{service_name} service is working properly.")
        else:
            print(f"{service_name} service is not running.")
            audit_status = "WARNING" # The indent error was here :D
    return audit_status
De plus, j'ai modifié la fonction d'installation. Désormais, elle effectue une vérification préalable pour s'assurer que la machine est bien un modèle Dell avant de procéder à l'installation du logiciel. ( A voir si vous voulez garder cette méthode, l'autre fonctionne aussi )

Code : Tout sélectionner

def install():
    
    def get_system_manufacturer():
        return registry_readstring(HKEY_LOCAL_MACHINE, "SYSTEM\HardwareConfig\Current", "SystemManufacturer")  # Ex: Dell Inc.    
    
    # Declaring local variables
    bin_name = glob.glob("Dell-Command-Update-Windows-Universal-Application_*.EXE")[0]
    
    if "Dell" not in get_system_manufacturer():
        print(f"WARNING: {control.name} can only be installed on a Dell System! The installation will be ignored.")
        return

    # Installing the software
    print("Installing: %s" % bin_name)
    install_exe_if_needed(
        bin_name,
        silentflags="/s /factoryinstall",
        name="Dell Command | Update",
        min_version=control.get_software_version(),
        timeout=900,
    )

    # Disabling telemetry
    registry_set(HKEY_LOCAL_MACHINE, r"SOFTWARE\DELL\UpdateService\Clients\CommandUpdate\Preferences\Settings\General", "UserConsentDefault", 0)
    registry_set(HKEY_LOCAL_MACHINE, r"SOFTWARE\DELL\UpdateService\Clients\CommandUpdate\Preferences\CFG", "ShowSetupPopup", 0)
    
    # Download updates (notify when ready)
    # registry_set(
    #     HKEY_LOCAL_MACHINE, r"SOFTWARE\DELL\UpdateService\Clients\CommandUpdate\Preferences\Settings\Schedule", "AutomationMode", "ScanDownloadNotify"
    # )
    # registry_set(
    #     HKEY_LOCAL_MACHINE, r"SOFTWARE\DELL\UpdateService\Clients\CommandUpdate\Preferences\Settings\Schedule", "ScheduleMode", 
    #     "Auto"
    # )

    # Manual updates only
    registry_set(
        HKEY_LOCAL_MACHINE, r"SOFTWARE\DELL\UpdateService\Clients\CommandUpdate\Preferences\Settings\Schedule", "ScheduleMode", 
        "ManualUpdates"
    )

    # Disable notification
    registry_set(
        HKEY_LOCAL_MACHINE, r"SOFTWARE\DELL\UpdateService\Clients\CommandUpdate\Preferences\Settings\Schedule", "DisableNotification", 1
    )
Flavien.

Informations générales :

Serveur WAPT : Debian 11, version 2.4.0.14143, Édition Entreprise
Machine d'administration : Windows 11, version WAPT 2.4.0.14143