Page 1 of 1

[Tip] Managing chassis types.

Published: February 4, 2020 - 11:43 AM
by Gaetan
Hello everyone,
I needed to restrict the installation of certain packages to laptops.

So I implemented this code:

Code: Select all

CommandChassis = 'wmic systemenclosure get chassistypes'
Chassis = str(run(CommandChassis))

def install():
    print('installing tls-pulse-secure')
    if Chassis.find('8') != -1 or Chassis.find('9') != -1 or Chassis.find('10') != -1:
        run ()
        print ('Installé')
    else :
        print ('Ce n\'est pas un PC Portable')
The different chassis versions are designed to cover all variations of laptop PCs.
The list of chassis, for modifying the code, is here: https://docs.microsoft.com/en-us/window ... menclosure

The package is still installed on all machines, but the software only on the chosen chassis types.

If this can help ;)

Re: [Tip] Managing chassis types.

Published: February 5, 2020 - 1:23 PM
by Gaetan
I'm also adding the option to choose by brand.
Here, the option is to install only on DELL workstations:

Code: Select all

CommandVendor = 'wmic systemenclosure get manufacturer'

Vendor = str(run(CommandVendor))
installed = installed_softwares('Dell Update')

def install():
    print('installing tls-dell-command-update-3.1.0-a00')

    #Test si le PC est un DELL
    if Vendor.find('Dell Inc.') != -1:

        #Si le logiciel est déjà présent
        if installed:
            print('Already Install')
            for key in installed:
                run(uninstall_cmd(key['key']))
            install_exe_if_needed("Dell-Command-Update_V104D_WIN_3.1.0_A00.exe",'/s',key='',min_version='3.1.0',accept_returncodes=[0,3010,2])
            print('Install on DELL PC')
        else:
            install_exe_if_needed("Dell-Command-Update_V104D_WIN_3.1.0_A00.exe",'/s',key='',min_version='3.1.0',accept_returncodes=[0,3010,2])
            print('Install on DELL PC')