[SOLVED] Add-AppxProvisionedPackage and positional parameter

Questions about WAPT Packaging / Requests and help regarding Wapt packages.
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Locked
cefinformatique
Messages: 31
Registration: May 26, 2023 - 2:25 p.m.

June 26, 2025 - 1:19 PM

WAPT version: 2.6.0.17293

Good morning,

I'm trying to create a package to install the latest version of the 3CX client for Windows. So I retrieved 3CX.msix and its dependency: Microsoft.WindowsAppRuntime.1.7_7000.498.2246.0_x64__8wekyb3d8bbwe.msix, which I added both to the WAPT package directory.

Then I used this function:

Code: Select all

appx_package_name = "3CX"

def install():
    # Sélection du fichier principal .msix
    bin_path_candidates = glob.glob(makepath(f"{appx_package_name}.msix"))
    if not bin_path_candidates:
        raise Exception(f"Erreur : fichier {appx_package_name}.msix introuvable")
    bin_path = bin_path_candidates[0]

    # Détection des dépendances éventuelles
    dependencies_paths = [
        f'"{a}"' for a in glob.glob("*.msix")
        if not os.path.basename(a).startswith(appx_package_name)
    ]
    dependencies_pathes_str = ", ".join(dependencies_paths)

    # Construction de la commande PowerShell
    add_appx_cmd = (
        f'Add-AppxProvisionedPackage -Online '
        f'-PackagePath "{bin_path}" '
        f'-SkipLicense'
    )
    if dependencies_pathes_str:
        add_appx_cmd += f' -DependencyPackagePath {dependencies_pathes_str}'

    # Vérification de la version installée de l'appx
    appxprovisionedpackage = run_powershell(
        f'Get-AppXProvisionedPackage -Online | Where-Object DisplayName -Like "{appx_package_name}"',
        output_format="json"
    )
    current_version = appxprovisionedpackage[0]["Version"] if appxprovisionedpackage else "0.0.0.0"

    # Installation si version plus récente ou install forcée
    if Version(current_version, 4) < Version(control.get_software_version(), 4) or force:
        print(f"Installing: {os.path.basename(bin_path)}")
        killalltasks(ensure_list(control.impacted_process))
        run_powershell_script(add_appx_cmd.strip(), output_format="text")
    else:
        print(f"{appx_package_name} is already installed and up-to-date.")
But when I test the package I get the following error:

Code: Select all

Invoke-Expression : Impossible de trouver un paramètre positionnel acceptant l\'argument «3CX.msix -SkipLicense _x000D__x000A_</S><S S="Error">-DependencyPackagePath Microsoft.WindowsAppRuntime.1.7_7000.498.2246.0_x005F_x64__8wekyb3d8bbwe.msix»._x000D__x000A_</S><S S="Error">Au caractère Ligne:1 : 2_x000D__x000A_</S><S S="Error">+ (invoke-expression -Command "Add-AppxProvisionedPackage -Online -Pack ..._x000D__x000A_</S><S S="Error">
What's wrong with my job?
Last modified by cefinformatique on July 7, 2025 - 10:00 AM, modified 1 time.
jlepiquet
Messages: 69
Registration: Sep 3, 2024 - 4:09 p.m.

June 26, 2025 - 3:39 PM

Hello,

there seems to be an issue with adding packages as dependencies.
I'm taking advantage of your request to add the package to our store.

It's available in pre-production here: https://wapt.tranquil.it/wapt-testing/t ... EPROD.wapt
and will be available in production within 5 days.

Regards,
cefinformatique
Messages: 31
Registration: May 26, 2023 - 2:25 p.m.

July 1, 2025 - 11:21

Good morning,

Thank you for the package!

I just tested it on a Windows 11 Pro machine that I just reinstalled and I get this error:

Code: Select all

Erreur lors de l'installation de ['cef-3cx-appx(=20.0.895.0-66)']: erreurs dans les paquets [[PackageRequest(package='cef-3cx-appx',version=(Version('20.0.895.0'), 66),architectures=['x64'],locales=['fr'],maturities=['PROD'],tags=['windows-10', 'win-10', 'w-10', 'windows10', 'win10', 'w10', 'windows', 'win', 'w'],min_os_version=Version('10.0.26100'),max_os_version=Version('10.0.26100')), PackageEntry('cef-3cx-appx','20.0.895.0-66' architecture='x64',maturity='PROD',target_os='windows'), 'Traceback (most recent call last):\n  File "C:\\Program Files (x86)\\wapt\\common.py", line 5609, in install\n    result = self.install_wapt(p.localpath,\n  File "C:\\Program Files (x86)\\wapt\\common.py", line 4548, in install_wapt\n    raise e\n  File "C:\\Program Files (x86)\\wapt\\common.py", line 4454, in install_wapt\n    exitstatus = setup.install()\n  File "C:\\WINDOWS\\TEMP\\wapt2x3d94vg\\setup.py", line 36, in install\nIndexError: list index out of range\n']]
Traceback (most recent call last):
  File "<string>", line 1662, in run
  File "C:\Program Files (x86)\wapt\waptservice\waptservice_common.py", line 875, in run
    self._run()
  File "C:\Program Files (x86)\wapt\waptservice\waptservice_common.py", line 1484, in _run
    raise Exception(_('Error during install of {}: errors in packages {}').format(
Exception: Erreur lors de l'installation de ['cef-3cx-appx(=20.0.895.0-66)']: erreurs dans les paquets [[PackageRequest(package='cef-3cx-appx',version=(Version('20.0.895.0'), 66),architectures=['x64'],locales=['fr'],maturities=['PROD'],tags=['windows-10', 'win-10', 'w-10', 'windows10', 'win10', 'w10', 'windows', 'win', 'w'],min_os_version=Version('10.0.26100'),max_os_version=Version('10.0.26100')), PackageEntry('cef-3cx-appx','20.0.895.0-66' architecture='x64',maturity='PROD',target_os='windows'), 'Traceback (most recent call last):\n  File "C:\\Program Files (x86)\\wapt\\common.py", line 5609, in install\n    result = self.install_wapt(p.localpath,\n  File "C:\\Program Files (x86)\\wapt\\common.py", line 4548, in install_wapt\n    raise e\n  File "C:\\Program Files (x86)\\wapt\\common.py", line 4454, in install_wapt\n    exitstatus = setup.install()\n  File "C:\\WINDOWS\\TEMP\\wapt2x3d94vg\\setup.py", line 36, in install\nIndexError: list index out of range\n']]

Exception: Erreur lors de l'installation de ['cef-3cx-appx(=20.0.895.0-66)']: erreurs dans les paquets [[PackageRequest(package='cef-3cx-appx',version=(Version('20.0.895.0'), 66),architectures=['x64'],locales=['fr'],maturities=['PROD'],tags=['windows-10', 'win-10', 'w-10', 'windows10', 'win10', 'w10', 'windows', 'win', 'w'],min_os_version=Version('10.0.26100'),max_os_version=Version('10.0.26100')), PackageEntry('cef-3cx-appx','20.0.895.0-66' architecture='x64',maturity='PROD',target_os='windows'), 'Traceback (most recent call last):\n  File "C:\\Program Files (x86)\\wapt\\common.py", line 5609, in install\n    result = self.install_wapt(p.localpath,\n  File "C:\\Program Files (x86)\\wapt\\common.py", line 4548, in install_wapt\n    raise e\n  File "C:\\Program Files (x86)\\wapt\\common.py", line 4454, in install_wapt\n    exitstatus = setup.install()\n  File "C:\\WINDOWS\\TEMP\\wapt2x3d94vg\\setup.py", line 36, in install\nIndexError: list index out of range\n']]
Traceback (most recent call last):
  File "<string>", line 1662, in run
  File "C:\Program Files (x86)\wapt\waptservice\waptservice_common.py", line 875, in run
    self._run()
  File "C:\Program Files (x86)\wapt\waptservice\waptservice_common.py", line 1484, in _run
    raise Exception(_('Error during install of {}: errors in packages {}').format(
Exception: Erreur lors de l'installation de ['cef-3cx-appx(=20.0.895.0-66)']: erreurs dans les paquets [[PackageRequest(package='cef-3cx-appx',version=(Version('20.0.895.0'), 66),architectures=['x64'],locales=['fr'],maturities=['PROD'],tags=['windows-10', 'win-10', 'w-10', 'windows10', 'win10', 'w10', 'windows', 'win', 'w'],min_os_version=Version('10.0.26100'),max_os_version=Version('10.0.26100')), PackageEntry('cef-3cx-appx','20.0.895.0-66' architecture='x64',maturity='PROD',target_os='windows'), 'Traceback (most recent call last):\n  File "C:\\Program Files (x86)\\wapt\\common.py", line 5609, in install\n    result = self.install_wapt(p.localpath,\n  File "C:\\Program Files (x86)\\wapt\\common.py", line 4548, in install_wapt\n    raise e\n  File "C:\\Program Files (x86)\\wapt\\common.py", line 4454, in install_wapt\n    exitstatus = setup.install()\n  File "C:\\WINDOWS\\TEMP\\wapt2x3d94vg\\setup.py", line 36, in install\nIndexError: list index out of range\n']]
jlepiquet
Messages: 69
Registration: Sep 3, 2024 - 4:09 p.m.

July 4, 2025 - 12:34

Hello,

do you have any antivirus software that might be deleting files?
The error you received indicates that the file 3CXDMCC.3CX_20.0.895.0_x64__bhm4yemhnd70e.msix is ​​missing.

Could you please check this?

Sincerely,
cefinformatique
Messages: 31
Registration: May 26, 2023 - 2:25 p.m.

July 7, 2025 - 10:00

Hello,

I figured out where the problem was coming from: the package searches for the location of the msix files based on the package name. My package name is different from yours. So I renamed the 3cx-microsoft-store directory and it works now.

Thank you! :D
User avatar
dcardon
WAPT Expert
Messages: 1929
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

July 7, 2025 - 12:28

Hi Marc,

thanks for the feedback :-)

Denis
Denis Cardon - Tranquil IT
Share your experiences on WAPT! Send us your blog and article URLs in the "Your Opinion of the forum, and we'll feature them on the WAPT
Locked