Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Quickstart Official documentation Setuphelpers Changelog FAQ
Back to top
View this page
Toggle table of contents sidebar

# 5. FAQ - Packages Issues

## 5.1. How to Uninstall Software Not Installed with WAPT

After deploying WAPT, you may want to remove legacy software already installed on your endpoints. WAPT allows you to automate software uninstallation across multiple machines without requiring manual intervention on each device.

This can be achieved by creating a custom WAPT package containing Python code.

Warning

This method only works for software installed at the system level.

Procedure

1. Identify the software you want to uninstall.

2. Install the target software on a test machine to validate the package behavior.

3. Open the WAPT Console.

4. Go to:

> Packages Inventory > Make Package Template from Setup File > Package Template > Empty Package

5. Copy the following code into the package.

Note

Optionally, you can comment out the section starting with:

    ``if Version(to_uninstall["version"]) < Version(control.get_software_version()):``

if you want to uninstall all versions of the software, regardless of their version number.

6. Customize the code by replacing the software name with the name of the application you want to uninstall.

7. Optionally, add the software process name to the `impacted-process` field in the package control file. For example, for WinSCP, add: `winscp.exe`

8. Test the package on your local machine.

9. If the test is successful, upload the package to the WAPT server:

> WAPT Console > Packages Inventory > Import Package > Build and Upload Package

> Then select the package you are editing.

10. Deploy the package to the target machines in order to uninstall the software.

## 5.2. Conflict between Wapt configuration and GPO

Some GPOs that are enforced by the Domain Controler may conflict configuration strategies enforced by WAPT.

Basically, what will happen is that one policy will recurrently reset the other policy. If WAPT audit scripts are checking such configuration options, audits will constantly flutter between |OK| and |ERROR|.

As a general rule of thumb, if you have the WAPT Enterprise version which implements audit, your will get your best results using WAPT to enforce policies for the following 3 reasons :

- There may be a difference between which OUs the Active Directory shows in the standard RSAT console and where the end-point really knows it is in the Active Directory tree. This explains in good part why sometimes you think you are applying a GPO on a host of a OU, and then you observe that the policy has not applied on the host or some members of a OU. The WAPT agent knows exactly which OUs the device is a member of.

- There is no native way with Windows to report on whether GPOs have correctly applied or not. When using WAPT to configure policies, using the audit function in the WAPT configuration package is a simple way to ensure that the policy has been correctly applied. The policy will appear in the WAPT Console as |OK| or |ERROR|. If you use `print()` statements in your audit script, you can then know where and why your configuration has failed.

- Finally, configuration GPOs that embed confidential information such as identifiers and password may be easily intercepted by a threat actor. WAPT includes a simple method that allows to encrypt sensitive data that can then only be deciphered by the destination endpoint.

Therefore, we recommand using WAPT configuration packages instead of GPOs to deploy policies to your fleets, whenever possible.

## 5.3. I have deployed a software package on an organisation unit (OU), but I would like to exclude certain workstations

Unfortunately, due to OU inheritance. If a package is in dependency or conflict, it is not possible to exclude certain machines natively.

In this situation, it you remain two solutions :

1/ Manual Installation: If you want the package installed only on specific workstations within the OU, you must remove it from the OU-level deployment and install it manually on the targeted machines.

2/ Using a meta-package: Alternatively, you can create a meta-package that includes custom logic to target or exclude specific machines. This approach allows you to bypass the limitations of OU inheritance. You can find more information on how to create a meta-package here.

## 5.4. Installation that needs a system reboot

- You may need to install an application that implies a system reboot.

Here is a code example that lets you do it:

    from setuphelpers import *

    def install():
        last_boot = str(host_metrics()['last_bootup_time']).rsplit('.',1)[0]
        file_last_bootup_time = r'C:\last_bootup_time'

        if not isfile(file_last_bootup_time):
            print('first time installation is executed')

          # Insert here the code to be executed before the reboot.

            with open(file_last_bootup_time,'w') as f:
                f.write(last_boot)
            return "NEEDREBOOT"

        else:

            with open(file_last_bootup_time,'r') as f:
                data = f.read()

            if data == last_boot:
                print("Install already executed but system has not rebooted")
                return "NEEDREBOOT"
            else:
                print("Install already executed and system rebooted, I can continue")

                # Insert here the code to be executed after the reboot.

## 5.5. Updating WAPT packages from Python 2 to Python 3

Attention

With WAPT 2.0, the WAPT internals have switched to python3. WAPT packages MUST follow the new python3 syntax.

The principal syntax differences
Syntax | Python 2 | Python 3
--- | --- | ---
print | `print'Hello'` | `print('Hello')`
unicode string | `ur` | `r`
operators | `<> <=> !=` | `!=`
Windows registry access | `_winreg` | `winreg`

Hint

For more details, visit:

- https://python-future.org/compatible_idioms.html.

- https://blog.couchbase.com/tips-and-tricks-for-upgrading-from-python-2-to-python-3/.

## 5.6. Wapt service crashes during install or remove

Some customers have reported wapt service crashes.

When we dug deeper, we realised that these were caused by Bitdefender prohibiting the execution of Powershell. As a result, Bitdefender was shutting down the wapt server process.

This can be extended to all antivirus programs. Stay vigilant.

## 5.7. Problems when creating a WAPT package

### 5.7.1. Problems with access rights and PyScripter

When trying to install a package from PyScripter, if the following message appears:

Launch PyScripter using a Local Administrator account and redo the desired action.

### 5.7.2. The WAPT package is too big and I can not upload it on the repository

A message “Stream write error” can appear if you lack disk space on the machine that imports the package. Indeed, much space is needed because the package is first extracted, then signed, built and finally uploaded to the server (3 times the package size is needed). In that case, please apply the following procedure.

When a package is too big, it is necessary to build the WAPT package locally then to upload it with WinSCP or an equivalent utility.

- Build the WAPT package with PyScripter or manually build the package.

Hint

The WAPT package in `C:\waptdev`.

- Download and install WinSCP

- Using WinSCP, upload the WAPT package in the correct repository location according to the version of the WAPT repository.

- Once the upload has finished, recreate the `Packages` index file on the WAPT repository using the following command and remplacing repository by the repository location according to the version of the WAPT repository.

    wapt-scanpackages repository

### 5.7.3. Unable to create a file

WAPT - unable to create a file

You can try to clean the cache here : Appdatalocalwaptconsolecache.

### 5.7.4. Access violation error while re-signing a WAPT package

If the Access violation error appear, it may mean that the WAPT package is too big.

Manually edit the package and visit this procedure for signing large WAPT packages.

### 5.7.5. WAPT package in error

#### 5.7.5.1. Problem installing a WAPT package

I have a WAPT package that returns in error and the software is not installed on the computer when I physically go to check on the computer.

##### 5.7.5.1.1. Explanation

An error has occurred during the execution of the `setup.py`.

You can read and analyze error messages returned in the WAPT Console and try to understand and solve them.

The installation of the package will be retried at each upgrade cycle until the package does not return an error.

##### 5.7.5.1.2. Solution

- If WAPT returns an error code, research the error code on the Internet.

  Example for a MSI: 1618: another installation in already running. Restarting the computer should solve the problem.

Note

MSI error codes are available by visiting this website.

- Go to the computer and try to install the package with the WAPT command line utility. Then check that the software has installed.

Attention

Once the silent installation has finished, do nothing else.

The objective is to reproduce the behavior of the WAPT Agent.

- If the package installs silently in user context, this may mean that the software installer does not work in SYSTEM context.

- If it is still not working, launch the installation manually. It is possible for an error to appear explicitly describing the problem (ex: missing dependency, etc).

- It is possible that the installer does not support installing over an older version of the software, so you will have to explicitly remove older versions of the application before installing the new one.

#### 5.7.5.2. Error “timed out after seconds with output ‘600.0’”

Some packages return the following error in the WAPT Console:

    "Error timed out after seconds with output '600.0'"

##### 5.7.5.2.1. Explanation

By default, when installing a WAPT package embedding a run and a install_msi_if_needed command, WAPT will wait 600 seconds for the installer to finish its task.

If the installer has not finished in this delay, WAPT will stop the running installation.

##### 5.7.5.2.2. Solution

If the software to be installed is known to be big (Microsoft Office, Solidworks, LibreOffice, Katia, Adobe Creative Suite), it is possible that the 600 second delay will be too short.

You will have to increase the timeout value, ex: `timeout` = `1200`.

    run('"setup.exe" /adminfile office2010noreboot.MSP', timeout = 1200)

#### 5.7.5.3. Error “has been installed but the uninstall key can not be found”

Some WAPT packages return the following error in the WAPT Console:

    XXX has been installed but the uninstall key can not be found.

##### 5.7.5.3.1. Explanation

WAPT relies on Windows to install .msi binaries with `install_msi_if_needed` and .exe binaries with install_exe_if_needed.

By default, WAPT accepts return codes 0 (OK) and 3010 (computer restart required) and it verifies that the uninstall key is present.

Unfortunately, we can not fully trust these return codes, so WAPT does additional checks after completing the installation to make sure that all has gone well:

- It checks the presence of the uninstall key on the host.

- It checks that the version number of the software is equal or greater than the version number in the `control` file.

- If this is not the case, it infers that the software may not be present on the host.

The function returns the WAPT package in error. The installation will be retried at every upgrade cycle until the WAPT package returns no error.

##### 5.7.5.3.2. Solution

Attention

Before doing anything, it is advisable to go physically to the computer returning in error and to manually check whether the software has correctly installed. If the software has not installed correctly, refer to the section of this documentation on installing a package.

- If the software has installed correctly, this may mean that the uninstall key or the software version in the package is not correct.

- Retrieve the correct uninstall key and make changes to the WAPT package accordingly.

- If the error happens when using the `install_msi_if_needed` function, this means that the MSI installer is badly packaged and that it is returning an incorrect uninstall key.

#### 5.7.5.4. Error “has been installed and the uninstall key found but version is not good”

Some WAPT packages return the following error in the WAPT Console:

    XXX has been installed and the *uninstall key* found but version is not good.

##### 5.7.5.4.1. Explanation

When using `install_msi_if_needed` or `install_exe_if_needed` functions, additional checks are performed to make sure that all has gone well.

Attention

Before doing anything, it is advisable to go physically to the computer returning in error and to manually check whether the software has correctly installed. If the software has not installed correctly, refer to the section of this documentation on installing a package.

##### 5.7.5.4.2. Solution: with `install_msi_if_needed`

The informations being extracted from the MSI installer, this means that the MSI file does not return correct values or that the uninstall key is incorrect.

You can check using the Windows Command Line utility.

    wapt-get list-registry

If the returned key is not that which has been entered in the install section of the `setup.py`, it is not possible to use `install_msi_if_needed`.

You MUST review the install section of your `setup.py`, use the `run()` function and manually manage exceptions.

##### 5.7.5.4.3. Solution: with `install_exe_if_needed`

This probably means that the version number entered in the install_exe_if_needed function is not correct. Make corrections to the WAPT package accordingly.

Note

If the `min_version` argument has not been entered, WAPT will try to retrieve the version automatically from the .exe installer.

You can check the uninstall key and the version number using the command:

    wapt-get list-registry

If no version is provided with the wapt-get list-registry command, this means that the software installer does not provide an uninstall key.

There are 2 solutions:

- Use the argument `get_version` to provide the path to another `uninstallkey`.

    def install():

       def versnaps2(key):
           return key['name'].replace('NAPS2 ','')

       install_exe_if_needed('naps2-5.3.3-setup.exe',silentflags='/VERYSILENT',key='NAPS2 (Not Another PDF Scanner 2)_is1',get_version=versnaps2)

- Providing an empty value for `min_version` tells WAPT not to check for versions.

    min_version=' '

Attention

With this method, versions are no longer checked during updates!

#### 5.7.5.5. Error “DNSName values should be passed as an A-label string”

    FATAL ERROR : ValueError: DNSName values should be passed as an A-label string. This means unicode characters should be encoded via a library like idna.

Ensure that your workstation name does not contain any special characters.