From b646bad35f9132f078fddebe59aae4c158579b82 Mon Sep 17 00:00:00 2001 From: Gabriel Gendron Date: Thu, 21 Mar 2024 13:52:08 +0100 Subject: [PATCH] aaa --- setup.py | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/setup.py b/setup.py index b10646f..9259734 100644 --- a/setup.py +++ b/setup.py @@ -8,29 +8,9 @@ day_reboot = 'SUN' def install(): pass -def check_reboot_pending(hostname): - """ - Fonction pour vérifier si un poste a un reboot en attente. - - Args: - hostname: Le nom d'hôte du poste à vérifier. - - Returns: - True si un reboot est en attente, False sinon. - """ - returncode = run('systeminfo | find "Restart"',accept_returncodes=[0, 1, 3010]) - - if returncode: - return True - else: - return False - def audit(): - hostnames = ["localhost"] - reboot_pending = check_reboot_pending(hostnames) - print(reboot_pending) - if reboot_pending is True: - print(f"Le poste a un reboot en attente.") + if reg_key_exists(HKEY_LOCAL_MACHINE,r'SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired'): + print("Une mise à jour necéssite un redémarrage") WAPT.write_audit_data_if_changed("Update Reboot", "Reboot Pending", reboot_pending) run(f'schtasks /create /sc weekly /st {hour_reboot} /RU "NT AUTHORITY\SYSTEM" /d {day_reboot} /tn "Reboot_Update" /tr "shutdown /r /t 0"') return "WARNING"