Attention : support for WAPT 2.0 ended on June the 30th 2022.

Please upgrade to the latest supported version

Using WAPT with the Command Line

The WAPT agent provides a command line interface utility wapt-get.

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 cmd.exe.

  • If the User is not a Local Administrator or if the cmd.exe has not been launched with Local Administrator privileges, the command will be passed on to the waptservice.

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

  • Only Local Administrators and members of the waptselfservice Active Directory security group are allowed.

  • To force using the WAPT service as a Local Administrator, simply add -S after wapt-get.exe.

Using the more common functions in WAPT with the command line

wapt-get update

The update command allow to update the list of available packages.

The local WAPT agent will download 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 have been added on the repository, they become downloadable by the WAPT agent.

Note

The update command does not download packages, it only updates the local database of packages.

The command wapt-get update returns:

Update package list
Total packages: 751
Added packages:

Removed packages:

Upgradable packages:
upgrade
additional
install
remove
Repositories URL:
https://srvwapt.mydomain.lan/wapt
https://srvwapt.mydomain.lan/wapt-host

wapt-get upgrade

The command wapt-get upgrade allows to launch the installation of packages waiting to be upgraded or waiting to be installed.

The local WAPT agent downloads if necessary WAPT packages in its local cache then installs them.

Hint

It’s strongly advised to launch a wapt-get update command before launching a wapt-get upgrade command;

Without previously launching a update, the WAPT agent will install nothing;

The command wapt-get upgrade returns:

Installing tis-mumble
Shutting down Mumble
installing Mumble 1.2.8
Installing w7demo.domain.lan

=== install packages ===
w7demo.domain.lan (=3) | w7demo.domain.lan (3)

=== additional packages ===
tis-mumble                     | tis-mumble (1.2.8-1)

wapt-get install

The install command launches the installation of a package.

The command takes on argument. That argument is the package name with the repository prefix.

To install Mozilla Firefox, the command is wapt-get install <prefix>-firefox.

Note

If the package has not been downloaded to cache, install will first download the package to cache, then it will install it.

Attention

Installing a WAPT package with install does not add the package as a dependency to the host.

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

The command wapt-get install tis-firefox returns:

installing WAPT packages tis-firefox
Installing tis-firefox.local/wapt/tis-firefox_50.0.2-73_all.wapt: 44796043 / 44796043 (100%) (33651 KB/s)
Firefox Setup 50.0.2.exe successfully installed.
Disabling auto update
Disabling profile migration from ie
Override User UI

=== install packages ===
tis-firefox                    | tis-firefox (50.0.2-73)

wapt-get remove

The remove <package name> command removes a package.

The command takes on argument. That argument is the package name with the repository prefix.

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

Attention

Removing a WAPT package with remove does not remove the package dependency on the host.

The package will effectively be uninstalled from the machine, but it will automatically be reinstalled on the next :command:`upgrade`.

To completely remove a package from a host, do a remove for the targeted package, then edit the host configuration via the WAPT console to remove the package dependency on the host.

The command wapt-get remove tis-firefox returns:

Removing tis-firefox ...

=== Removed packages ===
  tis-firefox

wapt-get clean

The clean command removes packages from the C:\Program Files (x86)\wapt\cache folder.

The clean command is launched after each upgrade to save disk space.

The command wapt-get clean returns:

Removed files:
C:\Program Files (x86)\wapt\cache\tis-mumble_1.2.8-1_all.wapt
C:\Program Files (x86)\\wapt\cache\tis-vlc_2.2.4-2_all.wapt

Using special Command Lines with WAPT

wapt-get register

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

Hint

You can pass a description as an argument to the register, that description will be displayed in the WAPT console in the column description.

You may benefit from WAPT to improve your IT management by affecting a username or a computer serial as descriptions for your hosts.

The command wapt-get register "John Doe PC returns nothing.

wapt-get download

The wapt-get download <package name> command downloads the WAPT package to the local cache located at C:\Program Files\wapt\cache.

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

Downloading packages tis-7zip (=16.4-8)

Downloaded packages:
  C:\Program Files (x86)\wapt\cache\tis-7zip_16.4-8_all_all.wapt

wapt-get download-upgrade

The wapt-get download-upgrade command downloads packages to be upgraded to the local WAPT cache C:\Program Files (x86)\wapt\cache.

The command wapt-get download-upgrade returns:

=== downloaded packages ===
C:\Program Files (x86)\wapt\cache\tis-firebird_2.5.5.26952-1_all.wapt

wapt-get show

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

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

The command wapt-get show tis-firebird returns:

Display package control data for tis-firebird

package           : tis-firebird
version           : 2.5.5.26952-1
architecture      : all
section           : base
priority          : optional
maintainer        : Hubert TOUVET
description       : Firebird database SQL superserver with admin tools (Firebird Project)
filename          : tis-firebird_2.5.5.26952-1_all.wapt
size              : 7012970
repo_url          : https://srvwapt.mydomain.lan/wapt
md5sum            : 6f6d70630674f5d58a5259b1e6752221
repo              : global

wapt-get list

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

The command wapt-get list returns:

package

version

install status

install_date

description

tis-7zip

16.4-8

OK

2016-12-01T17:43

7-zip compression and archiving software for x86 and x64

tis-brackets

1.8-1

OK

2016-12-01T17:44

Brackets is a lightweight

tis-ccleaner

5.23.5808-0

OK

2016-12-01T18:55

the right choice utility to quickly clean up, repair and optimize Windows

tis-rsat-win7x64

2

OK

2016-12-02T10:46

package for MS RSAT Remote server admin windows6.1-kb958830-x64 pour Win7 SP1

tis-rsat-x64

1

OK

2016-12-02T10:51

package for MS RSAT Remote server admin windows6.1-kb958830-x64 pour Win7 SP1

tis-dotnetfx4.6

4.6.2-1

OK

2016-12-09T16:05

dot net FX 4.6.2 Framework CLient. Replaces 4/4.5/4.5.1/4.5.2/4.6/4.6.1

wapt-get upgradedb

The wapt-get upgradedb command upgrades the local WAPT database schema if necessary.

The command wapt-get upgradedb returns:

WARNING upgrade db aborted: current structure version 20161109 is newer or equal to requested structure version 20161109
No database upgrade required, current 20161109, required 20161109

wapt-get setup-tasks - wapt-get enable-tasks - wapt-get disable-tasks

The wapt-get setup-tasks command adds update and upgrade scheduled tasks to local host.

Hint

This function is useful when it is desirable not to use the WAPT service, otherwise waptservice will take care of it.

To make it work, the following arguments must be configured in wapt-get.ini:

  • waptupdate_task_maxruntime;

  • waptupgrade_task_maxruntime;

  • waptupdate_task_period;

  • waptupgrade_task_period;

Then:

  • The wapt-get enable-tasks command will enable scheduled tasks.

  • The wapt-get disable-tasks command will disable scheduled tasks.

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

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

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

wapt-get inventory

The wapt-get inventory command displays all local inventory information in JSON format.

The command wapt-get inventory returns:

{
  "wapt": {
    "setuphelpers-version": "1.3.8",
    "waptserver": {
      "dnsdomain": "mydomain.lan",
      "proxies": {
        "http": null,
        "https": null
      },
      "server_url": "https://srvwapt.mydomain.lan"
},
...

wapt-get update-status

The command wapt-get update-status resends local status to the WAPT inventory server.

Note

If a hardware component has changed on the computer, update-status would not report that information back to the WAPT inventory server.

To do so, the command to be used is inventory.

The command wapt-get update-status returns:

Inventory correctly sent to server https://srvwapt.mydomain.lan.

wapt-get setlocalpassword

The wapt-get setlocalpassword command allows to define a local password for WAPT package installations.

The command wapt-get setlocalpassword returns:

Local password:
Confirm password:
Local auth password set successfully

wapt-get reset-uuid

The wapt-get reset-uuid command retrieves the host UUID from BIOS and resends it to the WAPT inventory server.

The command wapt-get reset-uuid returns:

New UUID: B0F23D44-86CB-CEFE-A8D6-FB8E3343FE7F

wapt-get generate-uuid

The wapt-get generate-uuid command creates a new host UUID and resends it to the WAPT inventory server.

Hint

Some batches of computers have their BIOS with identical UUID. It is a BIOS manufacturer setting problem because no two UUID should be the same.

The command generate-uuid exist to solve that problem.

The command wapt-get generate-uuid returns:

New UUID: 6640f174-de90-4b00-86f7-d7834ceb45bc

wapt-get get-server-certificate

The wapt-get get-server-certificate command downloads the SSL certificate from the WAPT Server to use HTTPS to communicate with the WAPT Server.

The downloaded certificate is stored in C:\Program Files(x86)\waptssl\server.

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

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

wapt-get enable-check-certificate

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

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

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

wapt-get session-setup

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

Hint

The session-setup instruction sets are defined in WAPT package’s setup.py file.

Every instruction set is stored in a SQLite local database.

The command session-setup is launched at every startup, the user environment customization script is executed only once per user per package version.

Note

The argument ALL will launch session-setup for all installed WAPT packages.

The command wapt-get session-setup ALL returns:

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-rsat-x64 ... No session-setup. Done
Configuring tis-dotnetfx4.6 ... No session-setup. Done
Configuring tis-rsat-win7x64 ... No session-setup. Done
Configuring tis-mumble ... No session-setup. Done
Configuring tis-paint.net ... No session-setup. Done
Configuring wsagauvrit.domain.lan ... No session-setup. Done

Using the Command Line to create WAPT packages

wapt-get make-template

The wapt-get make-template <msi or exe file> <package name> command allows to create a package template from a MSI or an EXE installer.

You will find the complete procedure for creating WAPT packages.

Hint

  • If you have previously installed tis-waptdev package on your development computer, PyScripter editor will launch automatically and open the package in development mode.

The command wapt-get make-template C:\Users\User\Downloads\tightvnc-2.8.5-gpl-setup-64bit.msi tis-tightvnc returns:

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

wapt-get make-host-template

The wapt-get make-host-template <host FQDN> command creates an empty WAPT host package from a template.

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

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

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

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

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

wapt-get list-registry

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

The output of list-registry is a table listing uninstall keys for each software corresponding to the search term.

The command wapt-get list-registry firefox returns:

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 wapt-get sources <package name> command downloads sources from a source code management platform like Git or SVN.

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

wapt-get build-package

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

Note

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

The command wapt-get sources tis-firefox returns:

Building  C:\waptdev\tis-tightvnc-wapt

Package tis-tightvnc (=2.8.5.0-0) content:
 setup.py
 tightvnc-2.8.5-gpl-setup-64bit.msi
 WAPT\control
 WAPT\wapt.psproj
...done. Package filename C:\waptdev\tis-tightvnc_2.8.5.0-0_all.wapt
Signing C:\waptdev\tis-tightvnc_2.8.5.0-0_all.wapt

7-Zip [64] 16.04: Copyright (c) 1999-2016 Igor Pavlov: 2016-10-04

Open archive: C:\waptdev\tis-tightvnc_2.8.5.0-0_all.wapt
--
Path = C:\waptdev\tis-tightvnc_2.8.5.0-0_all.wapt
Type = zip
Physical Size = 1756459

Updating archive: C:\waptdev\tis-tightvnc_2.8.5.0-0_all.wapt

Items to compress: 0

Files read from disk: 0
Archive size: 1755509 bytes (1715 KiB)
Everything is Ok
Package C:\waptdev\tis-tightvnc_2.8.5.0-0_all.wapt signed: signature:
mOQINvKGfmcW4nu05aVc8MJqMtXdPv5I0qo5zCfMkIWvEeYYDDfnZLakPkXiqptiqcNbCdY8vOPs
qFMqwSMYUyKJ8d3DHEk8kdlIldkLsiAejkdsoiZDKlEFVCJgdKI13x4FcPfoZNw5DFPzmCZKbgkU
pWvGbGFwUx/3d9zcliciN82F0FveC6C0mqoh5A==

You can upload to repository with
  C:\Program Files (x86)\wapt\wapt-get.exe upload-package "C:\waptdev\tis-tightvnc_2.8.5.0-0_all.wapt"

wapt-get sign-package

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

Attention

sign-package does not rename the WAPT package with the chosen prefix of the Organization.

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

Signing C:\waptdev\smp-7zip_16.4.0.0-1_all.wapt

7-Zip [64] 16.04: Copyright (c) 1999-2016 Igor Pavlov: 2016-10-04

Open archive: C:\waptdev\smp-7zip_16.4.0.0-1_all.wapt
--
Path = C:\waptdev\smp-7zip_16.4.0.0-1_all.wapt
Type = zip
Physical Size = 2857855

Updating archive: C:\waptdev\smp-7zip_16.4.0.0-1_all.wapt

Items to compress: 0

Files read from disk: 0
Archive size: 2856021 bytes (2790 KiB)
Everything is Ok
Package C:\waptdev\smp-7zip_16.4.0.0-1_all.wapt signed: signature:
lAxMJBKlnZLFQG81Rwb80+cB6XHcNjazmVJI7+PLLcPfFkFVC5wojyMPVMKhUrjrSlWomj85L8CY
gZv/FsVspUij45TcikukbF8Rr+jy6saHskg42XINqZWCnP28k4bkIREdzYIkuKDABfr15gt3ecuN
E21ZU/SI8BtXOX/80w9hpbP6ivCzTaYZZk18dhLDzV04xM9QwPSZ2mjQspbVklpm2NL4F6gb5b9D
EwMjus74/MNc6BZeKtMcFcE3Ft18ROAJeF5hLws24jjCv6Gjjus+zlGlepWK0M2p7rIdvmC1BWB/
Y6e1mQpSoisAvhOpATFPqNJca/QTMANKiTD3OA==

wapt-get build-upload

The 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 build-upload, the WAPT packaging version number is incremented before upload, so to avoid having to modify manually the control file.

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

Building  C:\waptdev\tis-tightvnc-wapt
Package tis-tightvnc (=2.8.5.0-1) content:
 setup.py
 tightvnc-2.8.5-gpl-setup-64bit.msi
 WAPT\control
 WAPT\wapt.psproj
...done. Package filename C:\waptdev\tis-tightvnc_2.8.5.0-1_all.wapt
Signing C:\waptdev\tis-tightvnc_2.8.5.0-1_all.wapt

7-Zip [64] 16.04: Copyright (c) 1999-2016 Igor Pavlov: 2016-10-04

Open archive: C:\waptdev\tis-tightvnc_2.8.5.0-1_all.wapt
--
Path = C:\waptdev\tis-tightvnc_2.8.5.0-1_all.wapt
Type = zip
Physical Size = 1756458

Updating archive: C:\waptdev\tis-tightvnc_2.8.5.0-1_all.wapt

Items to compress: 0

Files read from disk: 0
Archive size: 1755509 bytes (1715 KiB)
Everything is Ok
Package C:\waptdev\tis-tightvnc_2.8.5.0-1_all.wapt signed: signature:
FVn2yx77TwUHaDauSPHxJZiPAyMQe4PqLF5n6wY9YPAwY4ijHe6NgDFrexXf8ZYbHAiNa5b8V/Qj
wTVHiqpbXnZotiVIGrJDhgbaLwZ9CK6pfWiflC4126nx6PMF3T1i6w0R0NOE2wJpOSRYESk7lDUz
9CPfzJCLcOXwh0F5eZc96wbkDkSbpn1f+x5tOlvyy/FW2m8RbZQhJcO21j9gGX7It0QNecaOxXgz
qkZZKBDNASOBYAF22M1+zHb59DWQ63Q8yMj5t5szEUTkGtQNG6vZz3gb9Yraq361BIGaBDYUM31j
ZgpaHvP0vdK3c1x1mhyhC7q6eZ/UCW5tETTCiA==

Uploading files...
WAPT Server user :admin
WAPT Server password:
Status: OK, tis-tightvnc_2.8.5.0-1_all.wapt uploaded, 1 packages analysed

wapt-get duplicate

The wapt-get duplicate <package source> <package new_duplicate> command duplicates a package downloaded from the repository and opens it as a PyScripter project.

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

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

The wapt-get edit <package name> command downloads and edits a WAPT package.

The command wapt-get edit tis-firefox returns:

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\tis-firefox-wapt

wapt-get edit-host

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

wapt-get upload-package

The wapt-get upload-package <path to the package> command uploads a package onto the main WAPT repository.

The command wapt-get upload-package C:\waptdev\tis-tightvnc_2.8.5.0-1_all.wapt returns:

WAPT Server user :admin
WAPT Server password:
tis-tightvnc_2.8.5.0-1_all.wapt uploaded, 1 packages analyzed
result: OK

wapt-get update-packages

The wapt-get update-packages <path to folder> command scans a local repository and creates the Packages index file.

The command wapt-get update-packages D:\Data\WAPT returns:

Packages filename: D:\waptdev\Packages
Processed packages:
  D:\Data\WAPT\groupe_base.wapt
  D:\Data\WAPT\tis-firefox_50.1.5.0-0_all.wapt
  D:\Data\WAPT\tis-tightvnc_2.8.5.0-1_all.wapt
  D:\Data\WAPT\tis-7zip_16.4.0.0-1_all.wapt
  D:\Data\WAPT\tis-mumble_3.14-3_all.wapt
  D:\Data\WAPT\tis-noforcereboot_1.0-1_all.wapt
Skipped packages:

Re-signing packages on the server using a command line

Danger

Before using this method, ensure that your WAPT Server is safe and not under the control of an unauthorized third party entity.

  • Copy your .crt and .pem to /tmp/ on the WAPT Server using Winscp or an equivalent tool.

  • It is then possible to re-sign all the packages at once on the WAPT Server with the following commands.

wapt-signpackages -d /var/www/wapt-host -c /tmp/wapt_pub_key.crt -k /tmp/wapt_priv_key.pem -s
wapt-signpackages -d /var/www/wapt -c /tmp/wapt_pub_key.crt -k /tmp/wapt_priv_key.pem -s
wapt-scanpackages /var/www/wapt/

Hint

Use this method if re-signing from the WAPT console method does not complete successfully.

Attention

Remove your .crt and .pem from /tmp/ on the WAPT Server.