Page 1 of 1

Extinction message packet

Published: April 14, 2020 - 3:12 PM
by Gaetan
Hello everyone,

Here is the package we use to display a message prompting the user to restart the computer:

setup.py file

Code: Select all

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

uninstallkey = []

#récupération de la langue du système
Language = locale.getdefaultlocale()
Language = Language[0]

#sélection du language à afficher
if Language == 'fr_FR' :
    DisplayMsg7 = "Ce poste n\'a pas ete redemarre depuis 7 jours, merci de le redemarrer \r Le service informatique"
    DisplayMsg15 = "Ce poste n\'a pas ete redemarre depuis 15 jours, merci de le redemarrer, avant son redemarrage automatique par nos soins \r Le service informatique"
elif Language == 'en_US' :
    DisplayMsg7 = "This computer has not been rebooted for 7 days, please reboot \r IT service"
    DisplayMsg15 = "This computer has not been rebooted for 15 days, please reboot, before reboot will be initiated by us \r IT service"
else :
    DisplayMsg7 = "Ce poste n\'a pas ete redemarre depuis 7 jours, merci de le redemarrer \r Le service informatique"
    DisplayMsg15 = "Ce poste n\'a pas ete redemarre depuis 15 jours, merci de le redemarrer, avant son redemarrage automatique par nos soins \r Le service informatique"

def install():
    print('installing tls-message-arret')

def audit():
    #Récupération de la date du dernier démarrage
    LastBoot = str(wmi_as_struct(wmi.WMI().Win32_OperatingSystem.query(fields=['LastBootUpTime'])))

    #Récupération de la date en chiffre
    Date = int(currentdate())
    LastBoot = int(LastBoot[21:29])

    #Comparaison entre la date actuelle et celle du boot, si + 7 jours affichage du message
    if (Date - LastBoot) > 15 :
        run('msg * %s' %(DisplayMsg15))
        return "ERROR"
    elif (Date - LastBoot) > 7 :
        run('msg * %s' %(DisplayMsg7))
        return "WARNING"
    else :
        return "OK"
Control file:

Code: Select all

package           : -message-arret
version           : 1.0-1
architecture      : all
section           : base
priority          : optional
name              :
categories        :
maintainer        : Gaëtan
description       : Displays a pop up if the computer has not been restarted since 7 days and 15 days
depends           :
conflicts         :
maturity          : PROD
locale            : fr,en
target_os         :
min_os_version    :
max_os_version    :
min_wapt_version  :
sources           :
installed_size    :
impacted_process  :
description_fr    : Affiche une pop up si le poste n'a pas été redemarré depuis 7 jours et 15 jours
description_pl    :
description_de    :
description_es    :
description_pt    :
description_it    :
description_nl    :
description_ru    :
audit_schedule    : 60m
editor            :
keywords          :
licence           :
homepage          :
package_uuid      : 
valid_from        :
valid_until       :
forced_install_on :
We have changed the audit interval to every hour.

Re: Extinction message packet

Published: April 14, 2020 - 6:32 PM
by sfonteneau
Haha, awesome, I approve! ;)

Re: Extinction message packet

Published: April 14, 2020 - 9:16 PM
by vcardon
sfonteneau wrote: Apr 14, 2020 - 6:32 PM Haha, awesome, I approve ;)
Simon, Gaëtan, how could we make this package international, rather than strictly French? That way, we can make it a universal WAPT package :) because the same need exists everywhere.

VC

Re: Extinction message packet

Published: April 15, 2020 - 8:40 AM
by PierreC
For your information, the package hasn't been thoroughly tested here yet due to a lack of time to deploy it globally before the isolation phase. I'd prefer an incremental response starting on day 8, something like a message every 4 hours on day 8, every 2 hours on day 9, and so on.
I'm not entirely sure about the procedure yet; our users are generally a bit averse to updates, and I want to prepare them a little so that WAPT doesn't become an enemy with harmful long-term habits. It's already been observed that our users have gotten into the habit of closing the update window every time they shut down, so we really need to educate them on these topics, and this package should clearly illustrate this need without becoming a "the IT department annoys me, I reboot my machine, close the window, and I'm good for a week" situation.

Re: Extinction message packet

Published: April 15, 2020 - 10:30 AM
by Gaetan
Hello Simon and Vincent,
thank you for your feedback.
I have updated the first message with language support (only FR and EN).