.. Reminder for header structure:
  Parts (H1)          : #################### with overline
  Chapters (H2)       : ******************** with overline
  Sections (H3)       : ====================
  Subsections (H4)    : --------------------
  Subsubsections (H5) : ^^^^^^^^^^^^^^^^^^^^
  Paragraphs (H6)     : """""""""""""""""""""

.. |ok| image:: wapt-resources/icon-ok.png
  :scale: 5%
  :alt: Feature available

.. |nok| image:: wapt-resources/icon-nok.png
  :scale: 5%
  :alt: Feature not available

.. meta::
  :description: Using WAPT with the Command Line
  :keywords: command line, WAPT, CLI, documentation

.. _wapt_cli:

################################
Using WAPT with the Command Line
################################

The WAPT Agent provides a command line interface utility :program:`wapt-get`.


Depending on the context, the :program:`wapt-get` command will use a different file :

* During workstation management (install, remove, update, etc.), :program:`wapt-get` will use the file :file:`wapt-get.ini`.

* If you are performing package development type actions, :program:`wapt-get` will use the contents of the file :file:`waptconsole.ini`.

However, it is possible to run :program:`wapt-get` using a configuration file with the "-c" or "--config=xxx" parameter.

.. figure:: wapt-resources/windows_command_line_interface_text-terminal-window.png
  :align: center
  :scale: 75%
  :alt: The Windows Command Line utility

  The Windows Command Line utility

.. note::

  * By default, command-line actions in WAPT are executed with the rights of the user who launched the :program:`cmd.exe`.

  * If the :program:`cmd.exe` has not been launched with :term:`Local Administrator` privileges, the command will be passed on to the :program:`waptservice`.

  * For security reasons, some actions will require a login and a password.

  * Only :term:`Local Administrators` and members of the *waptselfservice* Active Directory security group are allowed.

  * To force using the WAPT service as a :term:`Local Administrator`, simply add *-S* after :code:`wapt-get.exe`.

.. _wapt_cli_common_commands:

.. note::

   Each commands that takes a package name as a parameter can also take the unique *package_uuid* of the package as a parameter (:command:`wapt-get install`, :command:`wapt-get forget`, etc.).
   **Using a GUID** allows to specify a unique package **without ambiguity on its architecture or version**.
   For using the GUID in command you need to embrace the uuid between bracket.

   The *package_uuid* is listed in the output of :command:`wapt-get list` and :command:`wapt-get search`.

   For example:

      .. code-block::
        
        With CMD:

        wapt-get install {03e3fa75-5725-4e46-8934-eaa14ba4c829}
      
        With Powershell:

        wapt-get install "{03e3fa75-5725-4e46-8934-eaa14ba4c829}"


*************************************************************
Using the more common functions in WAPT with the command line
*************************************************************

wapt-get install
================

The :command:`wapt-get install` command launches the installation of a WAPT package.

To install Mozilla Firefox, the command is :command:`wapt-get install tis-firefox`.

It is possible to install several packages at once:

.. code-block::

  wapt-get install package1 package2

If the package has not been downloaded to cache, :command:`wapt-get install` will first download the package to cache, then the WAPT Agent will install the package.

.. attention::

  Installing a WAPT package with :command:`wapt-get install` does not add the package as a dependency to the host.

  The package is installed on the host, but if the computer is re-imaged, the package will not be reinstalled automatically.

The command :command:`wapt-get install tis-firefox` returns:

.. code-block:: bash

  Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
  installing WAPT packages tis-firefox
  https://srvwapt.mydomain.lan/wapt/tis-firefox_94.0.1-106_x64_windows_0f4137ed1502b5045d6083aa258b5c42_6.1_PROD_en_f5335369ad5805e8dbc1f8ae99b2258e.wapt : 14121562 / 54313787 (26%) (24624 KB/s)
  https://srvwapt.mydomain.lan/wapt/tis-firefox_94.0.1-106_x64_windows_0f4137ed1502b5045d6083aa258b5c42_6.1_PROD_en_f5335369ad5805e8dbc1f8ae99b2258e.wapt : 33131357 / 54313787 (61%) (29414 KB/s)
  https://srvwapt.mydomain.lan/wapt/tis-firefox_94.0.1-106_x64_windows_0f4137ed1502b5045d6083aa258b5c42_6.1_PROD_en_f5335369ad5805e8dbc1f8ae99b2258e.wapt : 50511741 / 54313787 (93%) (30412 KB/s)
  https://srvwapt.mydomain.lan/wapt/tis-firefox_94.0.1-106_x64_windows_0f4137ed1502b5045d6083aa258b5c42_6.1_PROD_en_f5335369ad5805e8dbc1f8ae99b2258e.wapt : 54313787 / 54313787 (100%) (30360 KB/s)
  Installing tis-firefox(=94.0.1-106)
  Installing: Firefox_Setup_94.0.1.exe
  Waiting for key key Mozilla Firefox 94.0.1 (x64 en-US) to appear in Windows registry
  Delete C:\Program Files (x86)\wapt\cache\tis-firefox_94.0.1-106_x64_windows_0f4137ed1502b5045d6083aa258b5c42_6.1_PROD_en_f5335369ad5805e8dbc1f8ae99b2258e.wapt

  Results:

  === install packages ===
    tis-firefox [x64_en_PROD]     | tis-firefox (94.0.1-106)                   | tis-firefox (50.0.2-73)

wapt-get update
===============

The :command:`wapt-get update` command allows to update the list of available packages.

The local WAPT Agent will download :file:`Packages` file from the private repository and compare it to its local database.

* If new updates are available, the WAPT Agent switches the packages status to **TO-UPGRADE**.

* If new software titles have been added on the repository, they become available for download by the WAPT Agent.

.. note::

  The :command:`wapt-get update` command does not download packages, it only updates the local database of packages.

The command :command:`wapt-get update` returns:

.. code-block:: bash

  Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
  Update package list from https://srvwapt.mydomain.lan/wapt, https://srvwapt.mydomain.lan/wapt-host
  Total packages: 8
  Added packages:

  Removed packages:

  Discarded packages count: 6
  Pending operations:
    install:
    upgrade:
    additional:
    remove:
    immediate_installs:
  Repositories URL :
    https://srvwapt.mydomain.lan/wapt
    https://srvwapt.mydomain.lan/wapt-host

wapt-get upgrade
================

The command :command:`wapt-get upgrade` launches the installation of WAPT packages waiting to be upgraded or waiting to be installed.

The local WAPT Agent first downloads its WAPT packages to the local cache, then the WAPT Agent installs them.

.. hint::

  It is strongly advised to launch a :command:`wapt-get update` command before launching a :code:`wapt-get upgrade` command.

  Without previously launching a :command:`wapt-get update`, the WAPT Agent will install nothing.

The command :command:`wapt-get upgrade` returns:

.. code-block:: bash

  Installing tis-mumble
  Shutting down Mumble
  installing Mumble 1.2.3

  === install packages ===
  tis-mumble                     

wapt-get remove
===============

The :command:`wapt-get remove <package name>` command removes the listed WAPT packages from the host.

The command takes one argument, the name of the WAPT package or a list of WAPT packages with the repository prefix.

To remove Mozilla Firefox, the command is :command:`wapt-get remove <prefix>-firefox`.

.. attention::

  Removing a WAPT package with :command:`wapt-get remove` does not remove the package dependency on the host.

  **The package will effectively be uninstalled from the host, but it will automatically be reinstalled on the next upgrade.**

  To completely remove a package from a host, do a :command:`wapt-get remove` for the targeted package, then edit the host configuration via the WAPT Console to remove the package dependency on the host.

The command :command:`wapt-get remove tis-firefox` returns:

.. code-block:: bash

  Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
  Removing tis-firefox ...

  Waiting for the removal of key key Mozilla Firefox 94.0.1 (x64 en-US) from Windows registry
  === Removed packages ===
    tis-firefox

wapt-get uninstall
==================

The :command:`wapt-get uninstall [<package name>]` command uninstalls the listed packages from the host if a :code:`def uninstall()` function exists in the :file:`setup.py` files of the listed packages.

The command takes one argument, the name of the WAPT package or a list of WAPT packages with the repository prefix.

.. attention::

  Running the uninstall package function does not delete the cached package on the host.

The command :command:`wapt-get uninstall tis-adwcleaner` returns:

.. code-block:: console

 Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
  Uninstalling tis-adwcleaner ...
  None
  Uninstallation done

wapt-get forget
===============

The :command:`wapt-get forget <package name>` command removes the package from the local database so that the lifecycle of the software title or the configuration is no longer managed by WAPT.

The command takes one argument, the name of the WAPT package or a list of WAPT packages with the repository prefix.

.. attention::

  Forgetting the WAPT package does not uninstall the software title or the configuration associated with the WAPT package.

The command :command:`wapt-get forget tis-adwcleaner` returns:

.. code-block:: console

  Using config file: C:\Program Files (x86)\wapt\wapt-get.ini

  === Packages removed from status ===
    tis-adwcleaner

wapt-get audit
==============

The :command:`wapt-get audit [<package name>]` command runs the audit function for the listed packages if a :code:`def audit()` function exists in the :file:`setup.py` files of the listed packages.

The command takes one argument, the name of the WAPT package or a list of WAPT packages with the repository prefix.

Also, the :command:`wapt-get audit ALL` command runs the audit function for all packages installed on the host.

The command :command:`wapt-get audit tis-firefox` returns:

.. code-block:: console

  Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
  Auditing tis-firefox ...
  Auditing tis-firefox
  OK: Uninstall Key Mozilla Firefox 94.0.1 (x64 en-US) in Windows Registry.
  tis-firefox -> OK

wapt-get show
=============

The :command:`wapt-get show <package name>` command displays informations stored in the :file:`Packages` index file.

If several versions of a WAPT package are available on the WAPT repository, each version of the package will be displayed.

.. white_toggle::
  :titleen: The command wapt-get show tis-7zip returns:
  :titlefr: La commande wapt-get show tis-7zip renvoie :

  .. code-block:: bash

    Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
    Display package control data for tis-7zip

    package           : tis-7zip
    version           : 19.00-25
    architecture      : x64
    section           : base
    priority          : optional
    name              : 7-Zip
    categories        : Utilities
    maintainer        : WAPT Team,Tranquil IT,Jimmy PELÉ
    description       : 7-Zip is a free and open-source file archiver with a high compression ratio
    depends           :
    conflicts         :
    maturity          : PROD
    locale            : all
    target_os         : windows
    min_wapt_version  : 1.7
    sources           : https://www.7-zip.org/download.html
    installed_size    :
    impacted_process  : 7zFM,7z,7zG
    description_fr    : 7-Zip est un logiciel gratuit et open source pour archiver des fichiers avec un taux de compression élevé
    description_pl    :
    description_de    : 7-Zip ist ein Datenkompressionsprogramm mit einer hohen Kompressionsrate
    description_es    : 7-Zip es un archivador de ficheros con una alta relación de compresión
    description_pt    : O 7-Zip é um compactador de arquivos com alta taxa de compressão
    description_it    :
    description_nl    :
    description_ru    : 7-Zip свободный файловый архиватор с высокой степенью сжатия данных
    audit_schedule    :
    editor            : Igor Pavlov
    keywords          : 7zip,7,zip,7-zip,file,archiver,high,compression,ratio
    licence           : LGPL
    homepage          : https://www.7-zip.org/
    package_uuid      : dc66ccd1-d987-482e-b792-04e89a3803f7
    valid_from        :
    valid_until       :
    forced_install_on :
    changelog         : https://www.7-zip.org/history.txt
    min_os_version    : 5.0
    max_os_version    :
    icon_sha256sum    : eddc038d3625902b6ddeaabd13dd91529e8d457ffbd0c554f96d343ae243a67a
    signer            : documentation
    signer_fingerprint: 3f2c0a02231a36eafa1f67905f5c083e4b66cb59942f69cbd231d778a1a25b3d
    signature         : QzhPeZFrRbjcGzfqRpoWsDP9Plaz6BBVlL3adq/MRM19D61+Aez/JiA8skriCgwSErJXbxOPfxusVqqIpEtyoqh/RlRcnmgCQqk2Fig4gmxpz0rHKokukPQlRk+HdC/uByxSjfp9oXuB3PVG2PZAFifjVBtjEX2QmV+OY6NdMI9dtkxCsn1Xotn2qhu2bwbJWQ0s51rD9emWuQR7l/8WXl+HoquuRho4aCeAOYd6Nta9ktVSR2FM6OO5ZeUOg4fsnMg+hwp2MlDOmBHX37aJm3hLYkGP2xWjpL9YDDxI7ruRXSHyT7YmbILrS0h1m3PTOiV8jy1hTLDgKVeptPWVgA==
    signature_date    : 2021-11-19T16:15:42.019196
    signed_attributes : package,version,architecture,section,priority,name,categories,maintainer,description,depends,conflicts,maturity,locale,target_os,min_wapt_version,sources,installed_size,impacted_process,description_fr,description_pl,description_de,description_es,description_pt,description_it,description_nl,description_ru,audit_schedule,editor,keywords,licence,homepage,package_uuid,valid_from,valid_until,forced_install_on,changelog,min_os_version,max_os_version,icon_sha256sum,signer,signer_fingerprint,signature_date,signed_attributes
    filename          : tis-7zip_19.00-25_x64_windows_0f4137ed1502b5045d6083aa258b5c42_5.0_PROD_a10c57d7848cf7b145d6cd64bf4d5389.wapt
    size              : 1704227
    md5sum            : a10c57d7848cf7b145d6cd64bf4d5389

    OK Package control signature checked properly by certificate documentation (fingerprint: 3f2c0a02231a36eafa1f67905f5c083e4b66cb59942f69cbd231d778a1a25b3d )

.. note::

  .. code-block::

    WARNING: control data signature can not be validated with certificates [<SSLCertificate cn='documentation' fingerprint=3f2c0a issuer='documentation' validity=2021-11-19 - 2031-11-17 Code-Signing=True CA=True>]

  If this message appears, it is because the certificate is not trusted.

  If you want to check the package, download it to cache and run the :command:`wapt-get show` on the local package.

  For example:

  .. code-block::

    wapt-get download tis-7zip
    wapt-get show "C:\Program Files (x86)\wapt\cache\tis-7zip_19.00-25_x64_windows_0f4137ed1502b5045d6083aa258b5c42_5.0_PROD_a10c57d7848cf7b145d6cd64bf4d5389.wapt"

wapt-get show-params
====================

The :command:`wapt-get show-params <package name>` command returns a list of :ref:`parameters <command-lines-options>` that would be passed on to the :command:`wapt-get install <package name> --params=PARAMS` command.

The command takes one argument, the name of the WAPT package or a list of WAPT packages with the repository prefix.

The command :code:`wapt-get show-params tis-7zip` returns:

.. code-block:: console

  Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
  tis-7zip : {True, 'documentation': True}

wapt-get show-log
=================

The :command:`wapt-get show-log <package name>` command return the latest audit logs stored in the local sqlite database of the WAPT Agent.

The command takes one argument, the name of the WAPT package or a list of WAPT packages with the repository prefix.

The command :command:`wapt-get show tis-7zip` returns:

.. code-block:: console

  Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
  Package: tis-7zip (21.06-34) PROD
  -------------------
  Status: OK

  Installation log:
  -------------------
  Installing: 7z2106-x64.msi
  Waiting for key key {23170F69-40C1-2702-2106-000001000000} to appear in Windows registry

  Installation Parameters:
  -------------------
  {}

  Last audit:
  -------------------
  Status: OK
  Date: 2022-01-06T10:32:38.698272

  Output:
  Auditing tis-7zip
  OK: Uninstall Key {23170F69-40C1-2702-2106-000001000000} in Windows Registry.

  Next audit on: 2022-01-06T10:32:38.698272

.. _wapt_get_search:

wapt-get search
===============

The :command:`wapt-get search` command allows to search for one or more package in the repositories.

.. warning::

  This command returns only WAPT packages available for the host executing the command, according to the locale, operating system, architecture or maturity of the host.

  If a WAPT package with another locale, operating system, architecture or maturity exists in the repository, it will not be listed.

The search command takes one keyword argument.

The command :command:`wapt-get search "Firefox"` returns (for example):

.. code-block:: bash

  status     package            version    target_os       architecture maturity locale description                                                        repo
  ---------- ------------------ ---------- --------------- ---- ----- --- -------------------------------------------------------------------------------- ----------
  -          tis-firefox        94.0.2-106 windows         x64  PROD  fr  Mozilla Firefox est un navigateur web gratuit et open source                     wapt
  I          tis-config-firefox 68.3-6     windows         all  PROD      Configuration for Mozilla Firefox - The package will not have any effect if an*  wapt
  I          tis-firefox-esr    91.3.0-105 windows         x64  PROD  fr  Mozilla Firefox Extended Support Release (ESR) est une version officielle de*    wapt

.. list-table::
  :header-rows: 1
  :stub-columns: 1
  :widths: auto
  :align: center

  * - Value
    - status
    - package
    - version
    - target_os
    - architecture
    - maturity
    - locale
    - description
    - repo
  * - Description
    - Packages installation status
    - Name of package
    - Version of package
    - Target OS (if defined)
    - Architecture of CPU (if defined)
    - Maturity of package (if defined)
    - Locale of package (if defined)
    - Description of package
    - Folder of package on the WAPT Server

.. note::

  The value of :guilabel:`status` defines the installation status as follows:

    * :code:`-` for not installed.

    * :code:`I` for installed.

.. Hint::

  Under Pyscripter or VsCode you can use this command.

    .. code-block::

      wapt-get search vlc --json
    
  The :guilabel:`--json` parameter provides a more structured view of the package information, making it particularly useful for developing a package.
  The output format resembles the structure of the Windows registry.

  Example of the output :

    .. figure:: wapt-resources/wapt-get_search_with_json.png
      :align: center
      :alt: wapt-get search with --json

      wapt-get search with --json





wapt-get download
=================

The :command:`wapt-get download <package name>` command downloads the WAPT package to the local cache.

The command :command:`wapt-get download tis-7zip` returns:

.. code-block:: bash

  Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
  Downloading packages tis-7zip(=19.00-25)
  https://srvwapt.mydomain.lan/wapt/tis-7zip_19.00-25_x64_windows_0f4137ed1502b5045d6083aa258b5c42_5.0_PROD_a10c57d7848cf7b145d6cd64bf4d5389.wapt : 1704227 / 1704227 (100%) (11804 KB/s)

  Downloaded packages:
    C:\Program Files (x86)\wapt\cache\tis-7zip_19.00-25_x64_windows_0f4137ed1502b5045d6083aa258b5c42_5.0_PROD_a10c57d7848cf7b145d6cd64bf4d5389.wapt

wapt-get download-upgrade
=========================

The :command:`wapt-get download-upgrade` command downloads packages to be upgraded to the local WAPT cache.

The command :command:`wapt-get download-upgrade` returns:

.. code-block:: bash

  Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
  https://srvwapt.mydomain.lan/wapt/tis-firefox_94.0.1-106_x64_windows_0f4137ed1502b5045d6083aa258b5c42_6.1_PROD_en_f5335369ad5805e8dbc1f8ae99b2258e.wapt : 18466658 / 54313787 (34%) (32089 KB/s)
  https://srvwapt.mydomain.lan/wapt/tis-firefox_94.0.1-106_x64_windows_0f4137ed1502b5045d6083aa258b5c42_6.1_PROD_en_f5335369ad5805e8dbc1f8ae99b2258e.wapt : 36390179 / 54313787 (67%) (32693 KB/s)
  https://srvwapt.mydomain.lan/wapt/tis-firefox_94.0.1-106_x64_windows_0f4137ed1502b5045d6083aa258b5c42_6.1_PROD_en_f5335369ad5805e8dbc1f8ae99b2258e.wapt : 52684289 / 54313787 (97%) (31564 KB/s)
  https://srvwapt.mydomain.lan/wapt/tis-firefox_94.0.1-106_x64_windows_0f4137ed1502b5045d6083aa258b5c42_6.1_PROD_en_f5335369ad5805e8dbc1f8ae99b2258e.wapt : 54313787 / 54313787 (100%) (30747 KB/s)

  === downloaded packages ===
    C:\Program Files (x86)\wapt\cache\B8D346E7-DDDB-0013-5A8A-425CF3B6199E.wapt
    C:\Program Files (x86)\wapt\cache\tis-firefox_94.0.1-106_x64_windows_0f4137ed1502b5045d6083aa258b5c42_6.1_PROD_en_f5335369ad5805e8dbc1f8ae99b2258e.wapt

wapt-get list
=============

The :command:`wapt-get list` command lists WAPT packages that are installed on the computer.

The command :command:`wapt-get list` returns:

.. code-block:: bash

  Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
  package                              version    install_status install_date     description                                                                      package_uuid      
  ------------------------------------ ---------- ---------- ---------------- -------------------------------------------------------------------------------- ------------------------------------
  tis-7zip                            21.06-34   OK         2021-12-10T14:57 7-Zip is a free and open-source file archiver with a high compression ratio      717a30cc-0d44-42d1-9538-0f2f298d8603
  tis-firefox                         94.0.1-106 OK         2021-12-10T14:58 Mozilla Firefox is a free and open-source web browser                            5a91f54a-3e27-44cf-a2b6-6b84012aa3a2

.. list-table::
  :header-rows: 1
  :stub-columns: 1
  :widths: auto
  :align: center

  * - package
    - version
    - install status
    - install_date
    - description
    - package_uuid
  * - Package Name
    - Package Version
    - Installation status
    - Date and time of installation
    - Package description
    - Unique UUID of the package

wapt-get list-upgrade
=====================

The :command:`wapt-get list-upgrade` command lists WAPT packages that need to be upgraded on the host.

The command :command:`wapt-get list-upgrade` returns:

.. code-block:: console

  Using config file: C:\Program Files (x86)\wapt\wapt-get.ini

  === upgrade packages ===
  tis-notepadplusplus(=8.2-10)

wapt-get -S tasks
=================

The :command:`wapt-get -S tasks` command checks whether some tasks are running or are pending in queue.

The command :command:`wapt-get -S tasks` returns:

.. code-block:: console

  About to speak to waptservice...
  Running task 14: Uninstall of tis-vlc (task #14), status:

.. _wapt_cli_special_commands:

*************************************
Using special Command Lines with WAPT
*************************************

wapt-get restart-waptservice
============================

The :command:`wapt-get restart-waptservice` restarts the :program:`waptservice` on Windows, Linux and macOS.

wapt-get add-config-from-url
============================

The :command:`wapt-get add-config-from-url <filelink> <sha256hashfile>` command fetches a :mimetype:`json` dynamic configuration file from the specified url and places the file into the :file:`conf.d` directory under the wapt installation folder.

The :code:`<sha256hashfile>` parameter is optional.

.. code-block:: bash

  C:\Users\administrator>wapt-get add-config-from-url https://srvwapt.mydomain.lan/wapt/conf.d/default_config_55863a6b54a47255097b6403731b36de716fc7ee9ec824bffad36d5fdc49b6b5.json
  New config installed as C:\Program Files (x86)\wapt\conf.d\default.json

wapt-get add-config-from-file
=============================

The :command:`wapt-get add-config-from-file <filepath>` command adds a :mimetype:`json` dynamic configuration file into the directory :file:`conf.d` under the wapt installation folder.

The path to the :mimetype:`json` dynamic configuration file is defined by :file:`<filepath>`.

wapt-get add-config-from-base64
===============================

The :command:`wapt-get add-config-from-file <base64 file>` command adds a :mimetype:`json` dynamic configuration file into the directory :file:`conf.d` under the wapt installation folder.

The path to the :mimetype:`json` dynamic configuration file is defined by :file:`<base64 file>`.

wapt-get remove-config
======================

The :command:`wapt-get remove-config <config-name>` command removes the specified :mimetype:`json` dynamic configuration files from the :file:`conf.d` folder under the wapt installation folder.

wapt-get list-config
====================

The :command:`wapt-get list-config` command lists installed :mimetype:`json` dynamic configuration files that are present in the :file:`conf.d` folder under the wapt installation folder.

.. code-block:: bash

  C:\Users\administrator>wapt-get list-config
  Using config file: C:\Program Files (x86)\wapt\wapt-get.ini

  config files are located in C:\Program Files (x86)\wapt\conf.d

  * config_base

wapt-get list-available-config
==============================

The :command:`wapt-get list-available-config` command lists all available :mimetype:`json` dynamic configuration files that are present on the WAPT Server and will show the command to install them.

Listing the available configurations requires that the user be authenticated.

.. code-block:: bash

  C:\Users\administrator>wapt-get list-available-config
  Server: https://srvwapt.mydomain.lan
  Server UUID: 32464dd6-c261-11e8-87be-cee799b43a00
  Server CABundle: 0

  Waptserver https://srvwapt.mydomain.lan Admin User () :admin
  Waptserver Password: *************

  default_config : wapt-get add-config-from-url https://srvwapt.mydomain.lan/wapt/conf.d/default_config_55863a6b54a47255097b6403731b36de716fc7ee9ec824bffad36d5fdc49b6b5.json
       Server: https://srvwapt.mydomain.lan
       Repo: https://srvwapt.mydomain.lan/wapt

  default : wapt-get add-config-from-url https://srvwapt.mydomain.lan/wapt/conf.d/default_91ab2cd1901b5e36214224229c3461e49e65f7b065ea6b0eb16bd83c7fcdda57.json
       Server: https://srvwapt.mydomain.lan
       Repo: https://srvwapt.mydomain.lan/wapt

  mac_config : wapt-get add-config-from-url https://srvwapt.mydomain.lan/wapt/conf.d/mac_config_2720657c276cbc0ee14734e68fbd0fadc4dea3171625406e10cd9828631e5c72.json
       Server: https://srvwapt.mydomain.lan
       Repo: https://srvwapt.mydomain.lan/wapt

wapt-get clean
==============

The :command:`wapt-get clean` command removes packages from the cache folder.

The command is launched after each :command:`wapt-get upgrade` to save disk space.

The command :command:`wapt-get clean` returns:

.. code-block:: bash

  Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
  Removed files:
  C:\Program Files (x86)\wapt\cache\tis-mumble_1.2.3-1_all.wapt
  C:\Program Files (x86)\\wapt\cache\tis-vlc_1.2.3-2_all.wapt

wapt-get add-upgrade-shutdown - wapt-get remove-upgrade-shutdown
================================================================

These 2 commands modify the file :file:`C:\\Windows\\System32\\GroupPolicy\\Machine\\Scripts\\scripts.ini` on Windows devices.

* The :command:`wapt-get add-upgrade-shutdown` command adds a :program:`waptexit` local security policy object, enabling the execution of :program:`waptexit` at system shutdown.

The command :command:`wapt-get add-upgrade-shutdown` returns:

.. code-block:: bash

  Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
  0

The :file:`scripts.ini` contains:

.. code-block:: ini

  [Shutdown]
  0CmdLine = C:\Program Files (x86)\wapt\waptexit.exe
  0Parameters =

* The :command:`wapt-get remove-upgrade-shutdown` command removes the :program:`waptexit` local security policy object, disabling the execution of :program:`waptexit` during system shutdown.

The command :command:`wapt-get add-upgrade-shutdown` returns:

.. code-block:: bash

  Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
  0

The :file:`scripts.ini` contains:

.. code-block:: ini

  [Shutdown]

.. _initial_host_registration:

wapt-get register
=================

The :command:`wapt-get register <description>` command reports the computer hardware and software inventory to the WAPT Server.

The :code:`<description>` parameter is optional.

.. hint::

  A description may be passed as an argument to the :command:`wapt-get register` command, the description will be displayed in the WAPT Console in the column :guilabel:`description`.

  You may benefit from WAPT to improve your IT management by affecting an inventory tag as a description for your hosts for example.

.. note::

  If the host is already registered, re-registering the host using a description updates the registered information.

The command :command:`wapt-get register "John Doe PC"` returns:

.. code-block:: bash

  Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
  Registering host against server: https://srvwapt.mydomain.lan
  Host correctly registered against server https://srvwapt.mydomain.lan.

If you enabled the user/password authentication for agents registration, you can register an agent with a dedicated user (previously created in the Console ACLs):

.. code-block:: bash

  wapt-get register --wapt-server-user=dedicatedwaptuser --wapt-server-passwd=password
  

wapt-get unregister
===================

The :code:`wapt-get unregister` command removes the hardware and software inventory of the host from the WAPT Server.

The command :code:`wapt-get unregister` returns:

.. code-block:: console

  Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
  Unregistering host from server: https://srvwapt.mydomain.lan
  Please get login for api/v3/hosts_delete:admin
  Password:
  Host correctly unregistered against server https://srvwapt.mydomain.lan.

wapt-get inventory
==================

The :command:`wapt-get inventory` command displays the inventory information of the host in :mimetype:`json` format.

.. white_toggle::
  :titleen: The command wapt-get inventory returns (in part):
  :titlefr: La commande wapt-get inventory renvoie (en partie) :

  .. code-block:: bash

    Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
    {
      "host_info": {
        "description": "John Doe PC",
        "system_manufacturer": "Xen",
        "system_productname": "HVM domU",
        "computer_name": "Documentation",
        "computer_fqdn": "Documentation.srvwapt.mydomain.lan",
        "dnsdomain": "mydomain.lan",
        "workgroup_name": "Documentation",
        "domain_name": null,
        "domain_controller": null,
        "domain_controller_address": null,
        "domain_info_source": "history",
        "networking": [
        {
          "iface": "{085AB96368A-05A3B96-43EC-B773-0C0BB96794D9}",
          "mac": "a2:1d:6e:fc:8d:e6",
          "addr": [
          {
            "addr": "192.168.0.1",
            "netmask": "255.255.255.0",
            "broadcast": "192.168.0.255",
            "connected": true
          },
          {
            "addr": "fe80::2437:567f:79c8:f964",
            "netmask": "ffff:ffff:ffff:ffff::/64",
            "broadcast": "fe80::ffff:ffff:ffff:ffff%3",
            "connected": true
          }
          ]
        }
        ],
        "gateways": [
        "192.168.0.254"
        ],
        "dns_servers": [
        "192.168.0.11"
        ],
        "connected_ips": [
        "192.168.0.1",
        "fe80::2437:567f:79c8:f964"
        ],
        "mac": [
        "a2:fc:1d:6e:8d:e6"
        ],
    ...

wapt-get update-status
======================

The command :command:`wapt-get update-status` sends the current status of the host to the WAPT Server.

.. note::

  If a hardware component has changed on the computer, :command:`wapt-get update-status` would not report that information back to the WAPT inventory Server.

  To do so, the command to use is :command:`wapt-get inventory`.

The command :command:`wapt-get update-status` returns:

.. code-block:: bash

  Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
  Updated host status correctly sent to the WAPT Server https://srvwapt.mydomain.lan. {'success': True, 'msg': 'update_host', 'result': {'uuid': 'B8D346E7-DDDB-0013-5A8A-425CF3B6199E', 'computer_fqdn': 'documentation.mydomain.lan', 'status_hashes': {'dmi': '124b8bcef5b690afea7cf8001351a22132885123', 'wmi': 'ae5dbb5627b7b3a5a31d5914a9dbf48b85b133da', 'host_info': 'e737a82da15fbe9cae88ba9b4a9662a73657d959', 'audit_data': None, 'wapt_status': 'bcb76ad07cf1b6f814082ec5a58c4fee0364a640', 'audit_status': 'c34adb535c711b59d4408f00f77b7392687d7e56', 'host_metrics': '9fc68bd98c82e0e9bece0ce3afaeeb63a3ed1db1', 'waptwua_status': '4f9dcf0af339ce28d7354283fd4e6bdaf17b85c8', 'waptwua_updates': 'c5cf38908fc549f499ade5b17ce221ff0ced377f', 'wuauserv_status': '7c30215c3c34566e5b0c69c9e1dbfe3e6117b837', 'host_capabilities': 'c31286122a213f3bb313531541582bb2ba1d0a81', 'installed_packages': '3279f3bf4d5ed5086b198fa94a6a6f422f519ab3', 'last_update_status': '347c5a8c01e182f1e03e5c9d0fe07dd87ab79153', 'installed_softwares': 'd582a6f7325af35eae17cb7ecdca59ef0d137dda', 'authorized_certificates': '2974f9535f813fc454b735193c31828b132a6ba0', 'waptwua_updates_localstatus': 'c5cf38908fc549f499ade5b17ce221ff0ced377f'}, 'server_uuid': '82295c4d-4944-11ec-bac6-a25b5d7da3d5'}, 'request_time': 0.046843767166137695}

wapt-get setlocalpassword
=========================

The :command:`wapt-get setlocalpassword` command allows to define a local password for installing WAPT packages.

The command :command:`wapt-get setlocalpassword` returns:

.. code-block:: bash

  Local password:
  Confirm password:
  Local auth password set successfully

wapt-get reset-uuid
===================

The :command:`wapt-get reset-uuid` command retrieves the host's :term:`UUID` from BIOS and sends it to the WAPT Server.

The command :command:`wapt-get reset-uuid` returns:

.. code-block:: bash

  Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
  New UUID: B0F23D44-86CB-CEFE-A8D6-FB8E3343FE7F

wapt-get generate-uuid
======================

The :command:`wapt-get generate-uuid` command generates a random :term:`UUID` for the host and sends it back to the WAPT Server.

The :command:`wapt-get generate-uuid` is useful if there are :ref:`bios UUID bugs <my_bios_uuid_bugs>` with some hosts in the fleet.

The command :command:`wapt-get generate-uuid` returns:

.. code-block:: bash

  Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
  New UUID: RND-0279A1F4-BBBE-43AE-A591-F82652E0104B

.. note::

  All randomly generated UUID start with *RND-*.

wapt-get get-server-certificate
===============================

The :command:`wapt-get get-server-certificate` command downloads the SSL certificate from the WAPT Server so that the WAPT Agent may establish a secured HTTPS connection with the WAPT Server.

The downloaded certificate is stored in :file:`<wapt>\\ssl\\server`.

The command :command:`wapt-get get-server-certificate` returns:

.. code-block:: bash

  Server certificate written to C:\Program Files (x86)\wapt\ssl\server\srvwapt.mydomain.lan.crt

wapt-get enable-check-certificate
=================================

The :command:`wapt-get enable-check-certificate` command downloads the SSL certificate from the WAPT Server and enables secured communication with the WAPT Server.

The :command:`wapt-get enable-check-certificate` command is used for :ref:`activating the verification of the SSL / TLS certificate <activating_HTTPS_certificate_verification>`.

The command :command:`wapt-get enable-check-certificate` returns:

.. code-block:: bash

  Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
  Server certificate : C:\Program Files (x86)\wapt\ssl\server\template-auto.test.lan.crt
  Certificate CN: template-auto.test.lan
  Pining certificate C:\Program Files (x86)\wapt\ssl\server\template-auto.test.lan.crt

wapt-get check-upgrades
=======================

The :command:`wapt-get check-upgrades` command shows the most recent update / upgrade status for the host.

The command :command:`wapt-get check-upgrades` returns:

.. code-block:: console

  Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
  {
    "running_tasks": [],
    "errors": [],
    "date": "2022-01-06T14:09:26.554391",
    "upgrades": [
      "tis-notepadplusplus(=8.2-10)"
    ],
    "pending": {
      "install": [],
      "upgrade": [
      "tis-notepadplusplus(=8.2-10)"
      ],
      "additional": [],
      "remove": [],
      "immediate_installs": []
    }
  }

wapt-get add-licence
====================

The :command:`wapt-get add-licence` command add a WAPT licence onto the WAPT Server.

The command :command:`wapt-get add-licence` returns:

.. code-block:: console

  Using config file C:\Program Files (x86)\wapt\wapt-get.ini
  Server: https://srvwapt.mydomain.lan
  Server UUID: 82295c4d-4944-11ec-bac6-a25b5d7da3d5
  Server CABundle: 0

  {"licence_nr":"6f011e23-cb70-40a4-b340-0d18ae1e2f02","product":"WAPT Enterprise","features":["full"],"licenced_to":"documentation","domain":"","contact_email":"documentation@tranquil.it","count":"10","valid_from":"2021-06-14T00:00:0","valid_until":"2022-01-12T00:00:0","renewal_url":null,"signed_attributes":["licence_nr","product","features","licenced_to","domain","contact_email","count","valid_from","valid_until","renewal_url","signed_attributes","signer","signature_date","signer_certificate","server_uuid"],"signer":"","signature_date":"2022-01-13T16:38:56","signer_certificate":"-----BEGIN CERTIFICATE-----\nMIIEIjCCAwqgAwIBAgIUIOMdx8FmRdmCNTHxOfKecSp/cAAwDQYJKoZIhvcNAQEL\nBQAwgZcxCzAJBgNVBAYTAkZSMSIwIAYDVQQHDBlTYWludCBTZWJhc3RpZW4gc3Vy\nIExvaXJlMRwwGgYDVQQKDBNUcmFucXVpbCBJVCBTeXN0ZW1zMSAwHgYDVQQDDBdy\nZWxpY2VuY2luZy50cmFucXVpbC5pdDEkMCIGCSqGSIb3DQEJARYVdGVjaG5pcXVl\nQHRyYW5xdWlsLml0MB4XDTIxMDYwODE0MTQ0MVoXDTMxMDYwNjE0MTQ0MVowgZcx\nCzAJBgNVBAYpk6dZrIrw9Kb5hee+1EgqEbudCBTZWJhc3RpZW4gc3VyIExvaXJl\nMRwwGgYDVQQKDBNUcmFucXVpbCBJVCBTeXN0ZW1zMSAwHgYDVQQDDBdyZWxpY2Vu\nY2luZy50cmFucXVpbC5pdDEkMCIGCSqGSIb3DQEJARYVdGVjaG5pcXVlQHRyYW5x\ndWlsLml0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzT43W8OhWXAe\nhDB+IWwQm9IGGdR0VY/klKcSheo/8jGlNziyH6BANhjFKYNX9UtQ+ghzv6BGfSTH\nyua1aXEQM89sSKFOoJztoD1L9FZtuWQb/vfLWkisP8fRPvH4B/tYG+5nchGa6+6r\nqGSGSpWcnj6CovgQR01ATUuHN3NV1N7q48hBT/ZT9R5U3sEi+hNK4eRIeZ220Pzm\nDoNGkVKlEiczgXuM77ezYp8UWvpk6dZrIrw9Kb5hee+1EgqEbgVmdARoaOPGTK8h\n8VW+milWsl4TEY19kxXWvva+M6wX00ipJ2LxEiu5+dlOok9E8i405UTNE7oSVYsF\n90/6S3C4twIDAQABo2QwYjAPBgNVHRMBAf8EBTADAQH/MCAGA1UdJQEB/wQWMBQG\nCCsGAQUFBwMDBggrBgEFBQcDAjAdBgNVHQ4EFgQUpRT6Co2uoWZMCwP7FKiF73+j\nfAEwDgYDVR0PAQH/BAQDAgHWMA0GCSqGSIb3DQEBCwUAA4IBAQAdXX5IkpuH/Gek\nPPHC4KvE/6GsU0kqLI1w5ML5pbF1zyCCL0nm4f8w2JJIJ2Ycdb4QVD27kJqgZcH1\nniYQ3RCIh6aasS8qpCOf90KkpvKMJiyk/ra7I6NSgPut4ErkoxUWocgF6SNFEjwB\naqUZY//Hkoqk2dXqdujLVGJfBpX95ZJ9PmFNLfsyUsvu1WcFMb0En0EUO74Mq4M3\nKo2S86G9pEDKooaN5Vq19biReOwQYpX1YlSLtrxFx8AM87auQgaD8EWSdA1q2ycN\n8ZnmXGxAhDv8hmE2Fv0x0t3hzYXxxcv1ZjYWRHlMUl/buWQQ35u9MFkjh7YZlTlM\nb9wjtN+W\n-----END CERTIFICATE-----\n","signature":"J7DZ+mja7zGghYFCDKh8WIxzzdhKPeoNswWjnKZziT+ddpoRdg45kZz4E8PxMIUzhTI8WIxzzdhKPeoNswrICpQ8t5kepzovZpoONwjgOQ5PoCAgDOE3NV+larFrMdkAjCpx4tV86n5gyXHJnlnH1OXCpKUBiIiP/de18bEgSSlgjXgE/wr2ZfclsRsRRfsRbGSterRKQcthNDrFlf8RjH5cpDnDvMJ+qJtTsqxA13/WT2NS2uNWZI93si/9mowWY8MdT/PZjosciCqijbq4oa+/FrPsALhUOtcGE9JylwknszUD5Ayfh+9sNLLxsG6eT0JlnNgf4nx9mXAu4GBg==","server_uuid":"82295c4d-4944-11ec-bac6-a25b5d7da3d5"}
  Login to server api/v3/licences
  Waptserver https://srvwapt.mydomain.lan Admin User () :admin
  Waptserver Password: ************
  Licence properly activated on server

wapt-get check-licences
=======================

The :command:`wapt-get check-licences` command shows the licences registered on the WAPT Server.

The command :command:`wapt-get check-licences` returns:

.. code-block:: console

  Using config file C:\Program Files (x86)\wapt\wapt-get.ini
  Server: https://srvwapt.mydomain.lan
  Server UUID: 36bf01bc-c8f5-11eb-bf04-36127be97253
  Server CABundle: 0

  Total licences count: 10
  Licenced to: documentation

  Valid Nr:b7b6e537-3cb7-4d9a-3cb7-2448020e2e51 Count:10 From:2022-01-13T00:00:0 Expire:2023-01-12T23:59:0 Server:36bf01bc-c8f5-11eb-bf04-36127be97253 Licencee:documentation

wapt-get dnsdebug
=================

The :command:`wapt-get dnsdebug` command shows network configuration data for the host, notably the local :abbr:`DNS (Domain Name Service)` data related to WAPT.

The command :command:`wapt-get dnsdebug` returns:

.. code-block:: console

  DNS Server : dns.mydomain.lan
  DNS Domain : mydomain.lan
  Main repo url: https://srvwapt.mydomain.lan/wapt
  wapt SRV: []
  waptserver SRV: []
  CNAME: []

*********************************************
Using the Command Line for user session setup
*********************************************

wapt-get session-setup
======================

The :command:`wapt-get session-setup` command launches user level customizations of installed WAPT packages.

The :command:`wapt-get session-setup` command runs the :ref:`def session_setup() <user_session_setup>` function defined in the :file:`setup.py` file of the WAPT package if the function exists.

.. note::

  The argument *ALL* will launch :command:`wapt-get session-setup` for all installed WAPT packages.

The command :command:`wapt-get session-setup ALL` returns:

.. code-block:: bash

  Configuring tis-7zip ... No session-setup. Done
  Configuring tis-ccleaner ... Already installed. Done
  Configuring tis-vlc ... No session-setup. Done
  Configuring mdl-tightvnc ... No session-setup. Done
  Configuring tis-brackets ... No session-setup. Done
  Configuring mdl-firefox-esr ... No session-setup. Done
  Configuring tis-paint.net ... No session-setup. Done

.. _wapt_cli_create_package:

**********************************************
Using the Command Line to create WAPT packages
**********************************************

wapt-get list-registry
======================

The :command:`wapt-get list-registry <keyword>` command lookups a keyword in software installed on the computer.

The command can take one case insensitive argument to search for the specified keyword.

The informations returned is: 

.. list-table::
  :header-rows: 1
  :align: center

  * - Information
    - Definition
    - Available on Windows
    - Available on Linux
    - Available on macOS
  * - :code:`UninstallKey`
    - Searches the uninstall key identifier in the registry hive.
    - |ok|
    - |nok|
    - |nok|
  * - :code:`Software`
    - Searches the name of the software in the registry hive.
    - |ok|
    - |ok|
    - |ok|
  * - :code:`Version`
    - Searches the version of the software in the registry hive.
    - |ok|
    - |ok|
    - |ok|
  * - :code:`Uninstallstring`
    - Searches the uninstall string of the software in the registry hive.
    - |ok|
    - |nok|
    - |nok|

.. note::

  * On Windows, WAPT searches in two registry locations:

    * :file:`Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall`.

    * :file:`Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall`.

  * On Linux, WAPT searches using :code:`Applications`.

  * On macOS, WAPT searches in :file:`/var/lib/dpkg/info/`.

The output of :command:`wapt-get list-registry` is a table listing *uninstall keys* for each software corresponding to the search term.

The command :command:`wapt-get list-registry firefox` returns (on Windows):

.. code-block:: bash

  Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
  UninstallKey                           Software                               Version             Uninstallstring
  ---------------------------------------------------------------------------------------------------------------------------------------------------------
  Mozilla Firefox 45.5.0 ESR (x64 fr)    Mozilla Firefox 45.5.0 ESR (x64 fr)    45.5.0              "C:\Program Files\Mozilla Firefox\uninstall\helper.exe"

wapt-get sources
================

The :command:`wapt-get sources <package name>` command downloads sources from a source code management repository like Git or SVN.

The command :command:`wapt-get sources tis-firefox` returns nothing;

wapt-get make-template
======================

.. warning::

  This method is deprecated, instead use the :ref:`WAPT Console to create a package template <create_package_from_console>`.

The :command:`wapt-get make-template <installer-path> [<packagename> [<source directoryname>]]` command allows to create a package template from a :mimetype:`msi` or an :mimetype:`exe` installer.

The command :command:`wapt-get make-template C:\\Users\\User\\Downloads\\tightvnc.msi tis-tightvnc` returns:

.. code-block:: console

  Using config file: C:\Users\Documentation\AppData\Local\waptconsole\waptconsole.ini
  Template created. You can build the WAPT package by launching
    C:\Program Files (x86)\wapt\wapt-get.exe build-package C:\waptdev\tis-tightvnc-wapt
  You can build and upload the WAPT package by launching
    C:\Program Files (x86)\wapt\wapt-get.exe build-upload C:\waptdev\tis-tightvnc-wapt

.. hint::

  * If you have previously installed `tis-waptdev <https://wapt.tranquil.it/store/tis-waptdev>`_ package on your development computer, :program:`PyScripter` editor will launch automatically and open the package in development mode.

wapt-get make-host-template
===========================

.. warning::

  This method is mainly for scripting, usually the host packages are automatically created with the WAPT Console.

The :command:`wapt-get make-host-template <hostname> [[<package>,<package>,...] [directory]]` command creates an empty WAPT host package from a template.

The command :command:`wapt-get make-host-template host01.mydomain.lan` returns:

.. code-block:: bash

  Using config file: C:\Users\Documentation\AppData\Local\waptconsole\waptconsole.ini
  Template created. You can build the WAPT package by launching
    C:\Program Files (x86)\wapt\wapt-get.exe build-package C:\waptdev\host01.mydomain.lan-wapt
  You can build and upload the WAPT package by launching
    C:\Program Files (x86)\wapt\wapt-get.exe build-upload C:\waptdev\host01.mydomain.lan-wapt

wapt-get make-group-template
============================

.. warning::

  This method is to be used only if you can not use the WAPT Console to create a package.

The :command:`wapt-get make-group-template <name of group>` command creates an empty WAPT *group* package from a template.

The command :command:`wapt-get make-group-template accounting` returns:

.. code-block:: bash

  Template created. You can build the WAPT package by launching
    C:\Program Files (x86)\wapt\wapt-get.exe build-package C:\waptdev\accounting-wapt
  You can build and upload the WAPT package by launching
    C:\Program Files (x86)\wapt\wapt-get.exe build-upload C:\waptdev\accounting-wapt

.. _build_package:

wapt-get build-package
======================

The :command:`wapt-get build-package <path to the package>` command builds a WAPT package and signs it with the private key of the :term:`Administrator`.

.. note::

  The path to the private key, the default prefix and the default development path **MUST** be properly set in the :file:`wapt-get.ini` file.

The command :command:`wapt-get build-package c:\waptdev\tis-dropbox` returns:

.. code-block:: console

  Using config file: C:\Users\documentation\AppData\Local\waptconsole\waptconsole.ini
  Building packages 1 packages
  Personal certificate is documentation
  Please type the password to decrypt the private key C:\Users\documentation\private\documentation.pem
  Password:
  Private key is <SSLPrivateKey 'C:\\Users\\documentation\\private\\documentation.pem'>
  Personal certificate is SSLCertificate cn=documentation
  Private key is <SSLPrivateKey 'C:\\Users\\documentation\\private\\documentation.pem'>
  Building c:\waptdev\tis-dropbox
  Signing c:\waptdev\tis-dropbox with key <SSLPrivateKey 'C:\\Users\\documentation\\private\\documentation.pem'> and certificate documentation (C:\Users\documentation\private\documentation.crt)
  Package c:\waptdev\tis-dropbox signed : signature : BN7j6lwloY...Iu9QVulA=
  ...done building. Package filename c:\waptdev\tis-dropbox_104.4.175-7_windows_0f4137ed1502b5045d6083aa258b5c42_5.1_PROD.wapt
  1 packages successfully built
  0 packages failed

  You can upload to repository with
    C:\Program Files (x86)\wapt\wapt-get.exe upload-package "c:\waptdev\tis-dropbox_104.4.175-7_windows_0f4137ed1502b5045d6083aa258b5c42_5.1_PROD.wapt"

.. warning::

  The directory name does not define the name of the package, nor does it define its prefix, these values are defined by the :file:`control` file.

wapt-get sign-package
=====================

The :command:`wapt-get sign-package <path to the package>` command signs a package with the private key of the :term:`Administrator`.

.. attention::

  :command:`wapt-get sign-package` does not rename the WAPT package with the chosen prefix of the :term:`Organization`.

The command :command:`wapt-get sign-package C:\\waptdev\\smp-7zip_16.4.0.0-1_all.wapt` returns:

.. code-block:: bash

  Using config file: C:\Users\documentation\AppData\Local\waptconsole\waptconsole.ini
  Signing packages c:\waptdev\tis-dropbox
  Personal certificate is SSLCertificate cn=documentation
  Please type the password to decrypt the private key C:\Users\documentation\private\documentation.pem
  Password:
  Private key is <SSLPrivateKey 'C:\\Users\\documentation\\private\\documentation.pem'>
  Signing c:\waptdev\tis-dropbox
    OK: Package c:\waptdev\tis-dropbox signed : signature : b'nJYfYswDWi'...b'v790D7uA='

.. _wapt_cli_build_upload:

wapt-get build-upload
=====================

The :command:`wapt-get build-upload <path to the package>` command builds and uploads a WAPT package onto the main WAPT repository.

.. hint::

  By passing the *-i* argument to :command:`wapt-get build-upload`, the WAPT packaging version number is incremented before the package is uploaded, so to avoid having to modify manually the :file:`control` file.

The command :command:`wapt-get -i build-upload C:\\waptdev\\tis-tightvnc-wapt` returns:

.. code-block:: bash

  Using config file: C:\Users\documentation\AppData\Local\waptconsole\waptconsole.ini
  Building packages 1 packages
  Personal certificate is documentation
  Please type the password to decrypt the private key C:\Users\documentation\private\documentation.pem
  Password:
  Private key is <SSLPrivateKey 'C:\\Users\\documentation\\private\\documentation.pem'>
  Personal certificate is SSLCertificate cn=documentation
  Private key is <SSLPrivateKey 'C:\\Users\\documentation\\private\\documentation.pem'>
  Building c:\waptdev\tis-dropbox
  Signing c:\waptdev\tis-dropbox with key <SSLPrivateKey 'C:\\Users\\documentation\\private\\documentation.pem'> and certificate documentation (C:\Users\documentation\private\documentation.crt)
  Package c:\waptdev\tis-dropbox signed : signature : s9FOLFQvYw...c9T3Hv1A=
  ...done building. Package filename c:\waptdev\tis-dropbox_104.4.175-7_windows_0f4137ed1502b5045d6083aa258b5c42_5.1_PROD.wapt
  1 packages successfully built
  0 packages failed
  Building and uploading packages to https://srvwapt.mydomain.lan
  Please get login for https://srvwapt.mydomain.lan/api/v3/upload_xxx:admin
  Password:
  c:\waptdev\tis-dropbox_104.4.175-7_windows_0f4137ed1502b5045d6083aa258b5c42_5.1_PROD.wapt[================================] 126459984/126459984 - 00:00:40
  Package uploaded successfully: 1 Packages uploaded, 0 errors

wapt-get duplicate
==================

The :command:`wapt-get duplicate <source_package> <duplicated_package>` command duplicates a package downloaded from the repository and opens it as a project using the :abbr:`IDE (Integrated Development Environment)` that has been specified in the :ref:`configuration of the WAPT Console <using_different_development_environments>`.

.. warning::

  Do not use this command to duplicate a *host* package.

.. list-table:: Allowed arguments when duplicating a WAPT package.
  :header-rows: 1
  :align: center

  * - Argument
    - Definition
    - Required
  * - <directory> or <source_package>
    - Defines the directory path to the WAPT package or the name of a specific package having a :mimetype:`.wapt` file extension.
    - |ok|
  * - <duplicated_package>
    - Defines the name of the new package.
    - |ok|
  * - <duplicated_package_version>
    - Changes the package version in the :file:`control` file.
      If the version is not defined, the same version is duplicated.
    - |nok|
  * - <duplicated_package_target_directory>
    - Defines the path to the target directory of the duplicated package.
      If the target directory is not defined, the duplicated package will be stored in the same directory as the source package.
    - |nok|

The command :command:`wapt-get duplicate tis-firefox tis-firefox-custom` returns:

.. code-block:: bash

  Package duplicated. You can build the new WAPT package by launching
    C:\Program Files (x86)\wapt\wapt-get.exe build-package C:\waptdev\tis-firefox-custom-wapt
  You can build and upload the new WAPT package by launching
    C:\Program Files (x86)\wapt\wapt-get.exe build-upload C:\waptdev\tis-firefox-custom-wapt

wapt-get edit
=============

.. warning::

  This method is to be used only if you can not use the WAPT Console to create a package.

The :command:`wapt-get edit <package uuid>` command downloads and opens the package in an :abbr:`IDE (Integrated Development Environment)` for modification.

The command takes one argument, the uuid of the WAPT package or a list of WAPT packages with the repository prefix.

The command :command:`wapt-get edit 1ac109e5-70ad-40e7-94cb-016f5ff76386` returns:

.. code-block:: console

  Using config file: C:\Users\documentation\AppData\Local\waptconsole\waptconsole.ini
  https://srvwapt.mydomain.lan/wapt/tis-firefox_94.0.1-106_x64_windows_0f4137ed1502b5045d6083aa258b5c42_6.1_PROD_en_f5335369ad5805e8dbc1f8ae99b2258e.wapt : 1629411 / 54313787 (3%) (2686 KB/s)
  https://srvwapt.mydomain.lan/wapt/tis-firefox_94.0.1-106_x64_windows_0f4137ed1502b5045d6083aa258b5c42_6.1_PROD_en_f5335369ad5805e8dbc1f8ae99b2258e.wapt : 8147055 / 54313787 (15%) (5679 KB/s)
  https://srvwapt.mydomain.lan/wapt/tis-firefox_94.0.1-106_x64_windows_0f4137ed1502b5045d6083aa258b5c42_6.1_PROD_en_f5335369ad5805e8dbc1f8ae99b2258e.wapt : 15207836 / 54313787 (28%) (7367 KB/s)
  https://srvwapt.mydomain.lan/wapt/tis-firefox_94.0.1-106_x64_windows_0f4137ed1502b5045d6083aa258b5c42_6.1_PROD_en_f5335369ad5805e8dbc1f8ae99b2258e.wapt : 19552932 / 54313787 (36%) (7249 KB/s)
  https://srvwapt.mydomain.lan/wapt/tis-firefox_94.0.1-106_x64_windows_0f4137ed1502b5045d6083aa258b5c42_6.1_PROD_en_f5335369ad5805e8dbc1f8ae99b2258e.wapt : 24984302 / 54313787 (46%) (7471 KB/s)
  https://srvwapt.mydomain.lan/wapt/tis-firefox_94.0.1-106_x64_windows_0f4137ed1502b5045d6083aa258b5c42_6.1_PROD_en_f5335369ad5805e8dbc1f8ae99b2258e.wapt : 29329398 / 54313787 (54%) (7143 KB/s)
  https://srvwapt.mydomain.lan/wapt/tis-firefox_94.0.1-106_x64_windows_0f4137ed1502b5045d6083aa258b5c42_6.1_PROD_en_f5335369ad5805e8dbc1f8ae99b2258e.wapt : 33674494 / 54313787 (62%) (6951 KB/s)
  https://srvwapt.mydomain.lan/wapt/tis-firefox_94.0.1-106_x64_windows_0f4137ed1502b5045d6083aa258b5c42_6.1_PROD_en_f5335369ad5805e8dbc1f8ae99b2258e.wapt : 40735275 / 54313787 (75%) (7534 KB/s)
  https://srvwapt.mydomain.lan/wapt/tis-firefox_94.0.1-106_x64_windows_0f4137ed1502b5045d6083aa258b5c42_6.1_PROD_en_f5335369ad5805e8dbc1f8ae99b2258e.wapt : 45623508 / 54313787 (84%) (7326 KB/s)
  https://srvwapt.mydomain.lan/wapt/tis-firefox_94.0.1-106_x64_windows_0f4137ed1502b5045d6083aa258b5c42_6.1_PROD_en_f5335369ad5805e8dbc1f8ae99b2258e.wapt : 53227426 / 54313787 (98%) (7603 KB/s)
  https://srvwapt.mydomain.lan/wapt/tis-firefox_94.0.1-106_x64_windows_0f4137ed1502b5045d6083aa258b5c42_6.1_PROD_en_f5335369ad5805e8dbc1f8ae99b2258e.wapt : 54313787 / 54313787 (100%) (7663 KB/s)
  Package edited. You can build and upload the new WAPT package by launching

.. hint::

  * If you have previously installed `tis-waptdev <https://wapt.tranquil.it/store/tis-waptdev>`_ package on your development computer, :program:`PyScripter` editor will launch automatically and open the package in development mode.
  * You can edit a local package by going in the package folder then typing :command:`wapt-get edit`.


wapt-get edit-host
==================

.. warning::

  This method is to be used only if you can not use the WAPT Console to create a package.

The :command:`wapt-get edit-host <host FQDN>` command edits a WAPT *host* package.

The command :command:`wapt-get edit-host RND-0279A1F4-BBBE-43AE-A591-F82652E0104B` returns:

.. code-block:: console

  Using config file: C:\Users\documentation\AppData\Local\waptconsole\waptconsole.ini
  Package edited. You can build and upload the new WAPT package by launching
  C:\Program Files (x86)\wapt\wapt-get.exe -i build-upload c:\waptdev\RND-0279A1F4-BBBE-43AE-A591-F82652E0104B_0-wapt

wapt-get update-package-sources
===============================

The :command:`wapt-get update-package-sources <path to the package>` command update run the :code:`def update_package()` function in :file:`update-package.py` file.

The command :command:`wapt-get update-package-sources tis-firefox` returns:

.. code-block:: console

  Using config file: C:\Users\documentation\AppData\Local\waptconsole\waptconsole.ini
  Latis Mozilla Firefox version is: 95.0.2
  Download URL is: https://download-installer.cdn.mozilla.net/pub/firefox/releases/95.0.2/win64/en-US/Firefox%20Setup%2095.0.2.exe
  Downloading: Firefox_Setup_95.0.2.exe
  Firefox_Setup_95.0.2.exe[================================] 54810424/54810424 - 00:00:07
  Software version updated (from: 94.0.1 to: 95.0.2)
  Packages updated :
  c:\waptdev\tis-firefox_0-wapt

.. note::

  You can launch the package update from the WAPT console. 
  
  Go to WAPT Packages, identify a package and right-click :guilabel:`launch update package`.

  But this is not the recommended use, Tranquil IT prefers to use :guilabel:`Update the package from the store`.

*******************************************************************
Using the command-lines for WaptWUA management |enterprise_feature|
*******************************************************************

wapt-get waptwua-scan
=====================

The :command:`wapt-get waptwua-scan` scans the status of Windows Updates against current rules and sends the result back to the WAPT Server.

.. white_toggle::
  :titleen: The command wapt-get waptwua-scan returns:
  :titlefr: La commande wapt-get waptwua-scan renvoie :

  .. code-block:: console

    Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
    Ensure wuauserv Auto Update option is disabled
    Scanning with windows updates rules:
    {
    "direct_download": false,
    "default_allow": false,
    "filter": "Type='Software' or Type='Driver'",
    "download_scheduling": "7d",
    "install_scheduling": null,
    "install_delay": null,
    "postboot_delay": "10m"
    }
    Downloading wsusscn2.cab file from https://srvwapt.mydomain.lan/waptwua/wsusscn2.cab
    wsusscn2.cab[================================] 1024297844/1024297844 - 00:02:04
    Windows updates rules have been changed
    Looking for updates with filter: Type='Software' or Type='Driver'
      Connecting to local update searcher using offline wsusscn2 file...
      Offline Update searcher ready...
    Waiting for WUA search to complete
    Done searching
    WUA Search completed !
    Updates scan done.
    Writing status in local wapt DB
    Status: OK
    (0, 0, 0)
    None
    re-enabling wuauserv previous state: 0

wapt-get waptwua-download
=========================

The :command:`wapt-get waptwua-download` command scans the status of the Windows Update Agent against current rules, then downloads the missing kb and finally sends the result to the WAPT Server.

.. white_toggle::
  :titleen: The command wapt-get waptwua-download returns:
  :titlefr: La commande wapt-get waptwua-download renvoie :

  .. code-block:: console

    Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
    Ensure wuauserv Auto Update option is disabled
    Downloading wsusscn2.cab file from https://srvwapt.mydomain.lan/waptwua/wsusscn2.cab
    wsusscn2.cab[================================] 1024297844/1024297844 - 00:00:26
    Start of install for all pending Windows updates
    Scanning with params:
    {
    "direct_download": false,
    "default_allow": false,
    "filter": "Type='Software' or Type='Driver'",
    "download_scheduling": "7d",
    "install_scheduling": null,
    "install_delay": null,
    "postboot_delay": "10m"
    }
    Scanning with windows updates rules:
    {
    "direct_download": false,
    "default_allow": false,
    "filter": "Type='Software' or Type='Driver'",
    "download_scheduling": null,
    "install_scheduling": null,
    "install_delay": null,
    "postboot_delay": "10m"
    }
    Bypassing scan, no change since last successful scan
    Writing status in local wapt DB
    Status: OK
    {'downloaded': [], 'missing': []}
    None
    re-enabling wuauserv previous state: 0

wapt-get waptwua-install
========================

The :command:`wapt-get waptwua-install` command installs pending Windows Updates on the host.

.. white_toggle::
  :titleen: The command wapt-get waptwua-install returns:
  :titlefr: La commande wapt-get waptwua-install renvoie :

  .. code-block:: console

    Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
    Ensure wuauserv Auto Update option is disabled
    Downloading wsusscn2.cab file from https://srvwapt.mydomain.lan/waptwua/wsusscn2.cab
    wsusscn2.cab[================================] 1024297844/1024297844 - 00:00:26
    Start of install for all pending Windows updates
    Scanning with params:
    {
    "direct_download": false,
    "default_allow": false,
    "filter": "Type='Software' or Type='Driver'",
    "download_scheduling": "7d",
    "install_scheduling": null,
    "install_delay": null,
    "postboot_delay": "10m"
    }
    Scanning with windows updates rules:
    {
    "allowed_products": null,
    "allowed_classifications": null,
    "allowed_severities": null,
    "allowed_updates": null,
    "forbidden_updates": null,
    "allowed_kbs": null,
    "forbidden_kbs": null,
    "default_allow": false
    }
    Looking for updates with filter: Type='Software' or Type='Driver'
      Connecting to local update searcher using offline wsusscn2 file...
      Offline Update searcher ready...
    Waiting for WUA search to complete
    Done searching
    WUA Search completed !
    Updates scan done.
    Installed 07609d43-d518-4e77-856e-d1b316d1b8a8 : MSXML 6.0 RTM Security Update (925673)
    Installed bb49cc19-8847-4986-aa93-5e905421e55a : Security Update for Microsoft Visual C++ 2005 Service Pack 1 Redistributable Package (KB2538242)
    Installed 729a0dcb-df9e-4d02-b603-ed1aee074428 : Security Update for Microsoft Visual C++ 2008 Service Pack 1 Redistributable Package (KB2538243)
    Installed 719584bc-2208-4bc9-a650-d3d6347eb32e : Security Update for Microsoft Visual C++ 2010 Service Pack 1 Redistributable Package (KB2565063)
    Installed a8761130-35b6-41ce-8b67-2d35bb2d0846 : 2021-02 Cumulative Update for .NET Framework 3.5 and 4.8 for Windows 10, version 20H2 for x64 (KB4601050)
    Installed 30f75e5d-2c46-42be-aef6-97ae730452be : 2021-07 Cumulative Update for Windows 10 Version 20H2 for x64-based Systems (KB5004945)
    Installed 6e88be6e-d470-4e7e-9f36-01479049aadb : 2021-08 Servicing Stack Update for Windows 10 Version 20H2 for x64-based Systems (KB5005260)
    Installed a15155a4-1299-41ff-9a39-28a33ce7cadd : 2021-12 .NET Core 3.1.22 Security Update for x64 Client (KB5009193)
    Installed 38db0ad6-27f8-4bf9-ab2a-cffc4d7bc390 : Windows Malicious Software Removal Tool x64 - v5.96 (KB890830)
    Scanning with windows updates rules:
    {
    "direct_download": false,
    "default_allow": false,
    "filter": "Type='Software' or Type='Driver'",
    "download_scheduling": "7d",
    "install_scheduling": null,
    "install_delay": null,
    "postboot_delay": "10m"
    }
    Windows updates rules have been changed
    Writing status in local wapt DB
    Status: OK
    []
    None
    re-enabling wuauserv previous state: 2

wapt-get waptwua-status
=======================

The :command:`wapt-get waptwua-status` command returns the most recent Windows Update status for the host.

.. code-block:: console

  Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
  {'enabled': None,
  'last_error': 'OperationalError: cannot rollback - no transaction is active',
  'last_install_batch': [],
  'last_install_date': None,
  'last_install_reboot_required': None,
  'last_install_result': None,
  'last_scan_date': '2022-01-07T10:20:50.213644',
  'last_scan_duration': 1490.500022649765,
  'missing_downloads': [],
  'rules_packages': [],
  'status': 'SCANNING',
  'wsusscn2cab_date': '2021-12-14T04:06:46'}
  None

**********************************************************************
Using the command-line for interacting with users |enterprise_feature|
**********************************************************************

wapt-get propose-upgrade
=========================

The :command:`wapt-get propose-upgrade` command offers logged in users to launch pending upgrades.

The command :command:`wapt-get propose-upgrade` returns:

.. code-block:: console

  Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
  {'result': 1, 'summary': 'waptexit launched for 1 sessions'}

*****************************************
Using the command-lines for initial setup
*****************************************

wapt-get create-keycert
=======================

The :code:`wapt-get create-keycert [<options>]` command creates a RSA key pair and X509 certificate.

.. list-table:: List of options available for creating certificates.
  :header-rows: 1
  :widths: auto
  :align: center

  * - Option
    - Description
    - Default Value
  * - :code:`--CommonName`
    - Displays the name of the certificate.
    - /
  * - :code:`--CommonName64`
    - Displays the name of the certificate, encoded in base64 (if accents, spaces etc..).
    - /
  * - :code:`--CodeSigning` |enterprise_feature|
    - Defines whether the certificate / key pair will be allowed to sign software packages.
    - :code:`0`
  * - :code:`--CA` |enterprise_feature|
    - Defines whether the certificate / key pair can be used to sign other certificates (i.e. to be allowed to behave as a main or an intermediate Certificate Authority).
    - :code:`0`
  * - :code:`--ClientAuth`
    - Defines a property (use) of the certificate.
    - :code:`1` for a non-CA certificate
  * - :code:`--PrivateKeyPassword`
    - Defines the password for unlocking the key if :code:`--NoPrivateKeyPassword` is not used.
    - Randomly generated password
  * - :code:`--PrivateKeyPassword64` if :code:`--PrivateKeyPassword` is not used
    - Defines the password for unlocking the key, encoded in base64 (if accents, spaces etc..).
    - Randomly generated password
  * - :code:`--NoPrivateKeyPassword`
    - Sets the private key as not being password protected if :code:`--PrivateKeyPassword` or :code:`--PrivateKeyPassword64` are not used.
    - Empty
  * - :code:`-F`
    - Forces the overwriting of an existing certificate.
    - /
  * - :code:`--Country`
    - Defines the name of the certificate holder’s country to register in the certificate.
    - /
  * - :code:`--Locality`
    - Defines the name of the certificate holder’s city to register in the certificate.
    - /
  * - :code:`--Organization`
    - Defines the name of the certificate holder’s Organization to register in the certificate.
    - /
  * - :code:`--OrgUnit`
    - Defines the name of the certificate holder’s Organization Unit (Service) to register in the certificate.
    - /
  * - :code:`--Email`
    - Defines the email address of the certificate holder to register in the certificate.
    - /
  * - :code:`--CAKeyFilename` 
    - Defines the path to the private key (:file:`.pem`) of a Certificate Authority.
    - Parameter :code:`default_ca_key_path` in :file:`waptconsole.ini`
  * - :code:`--CACertFilename` 
    - Defines the path to the public certificate (:file:`.crt`) of a Certificate Authority.
    - Parameter :code:`default_ca_cert_path` in :file:`waptconsole.ini`
  * - :code:`--CAKeyPassword`
    - Defines the password for unlocking the key of a Certificate Authority.
    - /
  * - :code:`-NoCAKeyPassword`
    - Sets the Certificate Authority key as not being password protected.
    - /
  * - :code:`--BaseDir`
    - Defines the folder where the private key and the public certificate will be stored.
    - Directory :code:`personal_certificate_path` in :file:`waptconsole.ini`
  * - :code:`-EnrollNewCert`
    - Copies the certificate to :file:`wapt\ssl`
    - /
  * - :code:`-SetAsDefaultPersonalCert`
    - Defines the :code:`personal_certificate_path` in :file:`waptconsole.ini`.
    - /

The command :code:`wapt-get create-keycert` returns:

.. code-block:: console

  Using config file C:\Users\Administrator\AppData\Local\waptconsole\waptconsole.ini
  BaseDir: C:\private\
  Common name of certificate to create: documentation
  Private Key Filename: C:\private\documentation.pem
  Certificate Filename: C:\private\documentation.crt
  New private key password: QR.-DVp6MPGW

.. warning::

  If :code:`default_ca_key_path` and :code:`default_ca_cert_path` are defined in :file:`waptconsole.ini`, then you must place the CA certificate in the same location otherwise this error appears:

  .. code-block:: console

    wapt-get create-keycert
    Using config file C:\Users\tisadmin\AppData\Local\waptconsole\waptconsole.ini
    BaseDir: C:\Users\tisadmin\private\
    Common name of certificate to create: CRT
    Exception at 00483595: Exception:
    CA Certificate C:\Program Files (x86)\wapt\ssl does not exist.

wapt-get build-waptagent
========================

The :command:`wapt-get build-waptagent [</ConfigFilename>]` compiles and uploads a :program:`waptagent.exe` and a :program:`waptupgrade.exe` packages using the :code:`/ConfigFilename` parameter to specify the content of the :file:`wapt-get.ini` :ref:`configuration file <wapt_agent_ini_file_options>` of the WAPT Agents.

.. note::

  By default, the command uses configuration elements from the :file:`waptconsole.ini` configuration file of the WAPT Console.

The command :command:`wapt-get build-waptagent` returns:

.. code-block:: console

  Building customized waptagent.exe installer
  ......................................................................................
  Built C:\Users\documentation\AppData\Local\Temp\wapt20220107T12203700000.tmp\waptupgrade\waptagent.exe
  Private key Password for C:\Users\documentation\private\documentation.crt : ********
  Building waptupgrade package
  Waptserver https://srvwapt.mydomain.lan Admin User () :admin
  Waptserver Password: ************
  Uploading customized waptagent.exe installer
  Uploading C:\Users\documentation\AppData\Local\Temp\wapt20220107T12203700000.tmp\waptupgrade\waptagent.exe to waptserver https://srvwapt.mydomain.lan
  OK
  Uploading C:\Users\documentation\AppData\Local\Temp\wapt20220107T12203700000.tmp\tis-waptupgrade_2.1.2.10605-0_all_PROD_all.wapt to waptserver https://srvwapt.mydomain.lan
  OK : 1 Packages uploaded, 0 errors. Errors:

.. _command-lines-options:

************************************
Using the command-lines with options
************************************

.. list-table::
  :header-rows: 1
  :align: center

  * - Option
    - Definition
  * - :code:`--version`
    - Shows the WAPT version number and exits.
  * - :code:`-h` | :code:`--help`
    - Shows this help message and exits.
  * - :code:`-c CONFIG` | :code:`--config=CONFIG`
    - Defines the path to another file like :file:`wapt-get.ini` or :file:`waptconsole.ini`.
      Replaces the file normally used by the command line.
  * - :code:`-l LOGLEVEL` | :code:`--loglevel=LOGLEVEL`
    - Defines the level of log files following this list: **debug**, **warning**, **info**, **error**, **critical** (default: warning).
  * - :code:`-D` | :code:`--direct`
    - Instructs not to use http service for :command:`update` / :command:`upgrade`.
  * - :code:`-S` | :code:`--service`
    - Requests a Waptservice user.
  * - :code:`-u` | :code:`--update-packages`
    - Runs :command:`wapt-get update` before the specified command.
  * - :code:`-f` | :code:`--force`
    - Forces the command.
  * - :code:`-p PARAMS` | :code:`--params=PARAMS`
    - Sets up parameters as a JSon Object.
  * - :code:`-r WAPT_URL` | :code:`-repo WAPT_URL` | :code:`--repository=WAPT_URL`
    - Overrules the URL of the main WAPT repository as defined in the :file:`wapt-get.ini` file or in the :file:`waptconsole.ini` file.
  * - :code:`-y` | :code:`--hide`
    - Hides the WAPT Console during the execution of the command.
  * - :code:`-F FILTER_ON_HOST_CAP` | :code:`--use-host-caps=FILTER_ON_HOST_CAP`
    - Filters the packages based on the current host capabilities (0/1).
  * - :code:`-i` | :code:`--inc-release`
    - Increments the release version number when building a WAPT package.
  * - :code:`-a UPDATE_SERVER_STATUS` | :code:`--update-server-status=UPDATE_SERVER_STATUS`
    - Sends the updated status of the host (soft, packages, etc..) to the WAPT Server after the action.
      :code:`UPDATE_SERVER_STATUS` takes a value of **True** or **False**.
  * - :code:`keep-signature-date`
    - Keeps the current package signature date, and file changetime.
      Only use with :command:`wapt-get sign-package`.
  * - :code:`-s SECTION_FILTER` | :code:`--sections=SECTION_FILTER`
    - Adds a filter **section** to :command:`wapt-get search`.
      Section is the :ref:`type of package <type_of_packages>`.
  * - :code:`-o REDIRECT_OUTPUT` | :code:`--output=REDIRECT_OUTPUT`
    - Redirects the output to a :mimetype:`.ini` file whose path is defined by :code:`REDIRECT_OUTPUT`.
  * - :code:`-j` | :code:`-json`
    - Switches to :mimetype:`json` formatted output for the purpose of making automation scripts.
  * - :code:`-e ENCODING` | :code:`--encoding=ENCODING`
    - Changes character encoding for the output.
  * - :code:`-x EXCLUDES` | :code:`--excludes=EXCLUDES`
    - Defines a comma separated list of files or directories to exclude when building a package.
  * - :code:`-k PERSONAL_CERTIFICATE_PATH` | :code:`--certificate=PERSONAL_CERTIFICATE_PATH`
    - Defines the path to the PEM X509 certificate to sign WAPT packages.
      Package are not signed if the parameter is not provided.
  * - :code:`-w PRIVATE_KEY_PASSWD` | :code:`--private-key-passwd=PRIVATE_KEY_PASSWD`
    - Defines the path to the file containing the private key password.
  * - :code:`-U USER` | :code:`--user=USER`
    - Defines an interactive user.
  * - :code:`-g USERGROUPS` | :code:`--usergroups=USERGROUPS`
    - Defines groups of the end-user as a :mimetype:`json` formatted array for checking installation permissions.
  * - :code:`-t MAX_TTL` | :code:`--maxttl=MAX_TTL`
    - Defines the maximum run time in minutes of the :program:`wapt-get` process before being killed by any subsequent :program:`wapt-get` (default: 60 minutes).
  * - :code:`-L LANGUAGE` | :code:`--language=LANGUAGE`
    - Overrides the locale for installing WAPT packages, example: **fr** (default: en).
  * - :code:`-m MD` | :code:`--message-digest=MD`
    - Defines the message digest type for :command:`wapt-get sign-package`.
  * - :code:`-n` | :code:`--newest-only`
    - Returns only the newest version of WAPT packages when using :command:`wapt-get search`.
  * - :code:`--locales=LOCALES`
    - Override packages locales filter when using :command:`wapt-get search`.
  * - :code:`--maturity=MATURITY`
    - Sets / changes the package maturity when building a WAPT package.
  * - :code:`--pin-server-cert`
    - Pins the server certificate when registering the WAPT Agent.
  * - :code:`--wapt-server-url=SET_WAPTSERVER_URL`
    - Defines the url of the WAPT Server when the parameter :code:`wapt_server` is not defined in the :file:`wapt-get.ini` configuration file of the WAPT Agent.
  * - :code:`--wapt-repo-url=SET_WAPTREPO_URL`
    - Defines the url of the WAPT repository when the parameter :code:`repo_url` is not defined in the :file:`wapt-get.ini` configuration file of the WAPT Agent.
  * - :code:`--wapt-server-user=WAPT_SERVER_USER`
    - Defines the user allowed to upload packages to the WAPT Server.
  * - :code:`--wapt-server-passwd=WAPT_SERVER_PASSWD`
    - Defines the user password allowed to upload packages to the WAPT Server.
  * - :code:`--log-to-windows-events`
    - Logs steps to the Windows event log.
  * - :code:`--use-gui`
    - Forces the use of GUI Helper even if not in development mode.
  * - :code:`--no-ide`
    - Tells WAPT not to launch the :abbr:`IDE (Integrated Development Environment)` when editing a WAPT package.
