tis-audit-service-netlogon

1.0.1-7
Package to making sure that the Windows service Netlogon is started and automatically starting since it's mandatory for WAPT Self-Service
448 downloads
Download

  Description 

  • package : tis-audit-service-netlogon
  • version : 1.0.1-7
  • architecture : all
  • categories : System and network
  • maintainer : WAPT Team, Tranquil IT, Jimmy PELÉ
  • description : Package to making sure that the Windows service Netlogon is started and automatically starting since it's mandatory for WAPT Self-Service
  • locale :
  • target_os : windows
  • min_wapt_version : 1.7
  • sources :
  • installed_size :
  • impacted_process :
  • description_fr : Paquet pour s'assurer que le service Windows Netlogon est démarré et démarre automatiquement car il est obligatoire pour WAPT Self-Service
  • description_pl :
  • description_de :
  • description_es :
  • description_pt :
  • description_it :
  • description_nl :
  • description_ru :
  • editor :
  • licence :
  • signature_date : 2020-08-06T14:47:00.233589

  Setup.py 

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

uninstallkey = []

service_name = 'Netlogon'
service_start_mode = 'Automatic'


def install():
    print("Actual status of %s is: %s" % (service_name,service_get_start_mode(service_name)))
    if not service_get_start_mode(service_name) == 'Auto':
        service_set_start_mode(service_name, service_start_mode)
        service_restart(service_name)
        print("New status of %s is: %s" % (service_name,service_get_start_mode(service_name)))


def update_package():
    # Incrementing version of the package
    control.version = '%s-%s'%(control.get_software_version(),int(control.version.split('-')[-1])+1)
    control.save_control_to_wapt()
    print('Changing version to: %s in WAPT\\control' % control.version)


def audit():
    if not service_installed(service_name):
        print("Service %s is NOT installed, you will probably need to repair Windows" % service_name)
        return "ERROR"
    if not service_get_start_mode(service_name) == 'Auto':
        print("Starting mode of %s is NOT: %s. WAPT is reinstalling the package to fix that" % (service_name,service_start_mode))
        install()
    if not service_is_running(service_name):
        print("Service %s was NOT running. WAPT is restarting it" % service_name)
        service_restart(service_name)
        install()
        return "WARNING"
    else:
        print("Service %s is running" % service_name)
        return "OK"




def service_set_start_mode(service_name, StartMode):
    """Changing start mode of a service
    Usable values: "Boot" "System" "Automatic" "Manual" "Disabled"
    Informations: https://msdn.microsoft.com/en-us/library/aa384896(v=vs.85).aspx
    """
    import wmi
    c = wmi.WMI()
    for service in c.Win32_Service(Name=service_name):
        service.ChangeStartMode(StartMode=StartMode)


def service_get_start_mode(service_name):
    """Getting actual start mode of a service
    Returned values: "Boot" "System" "Auto" "Manual" "Disabled"
    """
    import wmi
    s = wmi.WMI()
    for service in s.Win32_Service(Name=service_name):
        #print(service.State, service.StartMode, service.Name, service.DisplayName)
        return service.StartMode




										

  Changelog 



No changelog.txt.
									
  manifest.sha256