Page 1 of 1

[SOLVED] Add-AppxProvisionedPackage and positional parameter

Published: June 26, 2025 - 1:19 PM
by cefinformatique
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?

Re: Add-AppxProvisionedPackage and positional parameter

Published: June 26, 2025 - 3:39 PM
by jlepiquet
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,

Re: Add-AppxProvisionedPackage and positional parameter

Published: July 1, 2025 - 11:21
by cefinformatique
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']]

Re: Add-AppxProvisionedPackage and positional parameter

Published: July 4, 2025 - 12:34 PM
by jlepiquet
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,

Re: Add-AppxProvisionedPackage and positional parameter

Published: July 7, 2025 - 10:00 AM
by cefinformatique
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

Re: [SOLVED] Add-AppxProvisionedPackage and positional parameter

Published: July 7, 2025 - 12:28 PM
by dcardon
Hi Marc,

thanks for the feedback :-)

Denis