Pagina 1 di 1

Aggiornamento del comando Re Dell

Pubblicato: 21 settembre 2023 - 09:53
di SeiyaGame
Buongiorno,

Vorrei tornare al argomento precedente riguardo a questo pacchetto.

Ho corretto la funzione di controllo; si era verificato un piccolo errore di indentazione. Questo errore faceva sì che il controllo visualizzasse sempre un messaggio di AVVISO nonostante il servizio fosse installato correttamente.

Codice: Seleziona tutto

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
Inoltre, ho modificato il processo di installazione. Ora esegue un controllo preliminare per verificare che il computer sia effettivamente un modello Dell prima di procedere con l'installazione del software. (Valuta se mantenere questo metodo; anche l'altro funziona.)

Codice: Seleziona tutto

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
    )
Flavio.

Informazioni generali:

Server WAPT: Debian 11, versione 2.4.0.14143, Enterprise Edition
Macchina di amministrazione: Windows 11, versione WAPT 2.4.0.14143