Add-AppxProvisionedPackage parameters

Trying to install an appx file but cant get the parameters or syntax correct for the PSADT. Has anyone used this is the past successfully. Below is what I am trying to run but keeps erroring out on this line.

Add-AppxProvisionedPackage -PackagePath “$dirFiles\sample.appx” -Online -SkipLicense

I too would be interested in anyone elses experience of this.

It might be worth slightly modifying your command to:

Add-AppxProvisionedPackage -PackagePath "$($dirFiles)\sample.appx" -Online -SkipLicense

As it might be trying to look for a variable named $dirFiles\sample.appx rather than $dirFiles

1 Like

This is what I use:

    $ext = @('*.appx*','*.Msix*')
    Get-ChildItem -Path $dirFiles -Include $ext -Recurse -Force -ErrorAction SilentlyContinue | Select-Object -ExpandProperty FullName| 
        ForEach-Object {
            $appxFileName = Split-Path -Path "$($_)" -Leaf
            Try {
                Add-AppxProvisionedPackage -PackagePath "$($_)" -Online -SkipLicense -LogPath "$($logFolder)\addStore.log" -ErrorAction Stop
            }Catch {
                Write-Log -Message "`tERROR Installing DISM_package [$($appxFileName)]`n`tERROR: [$($_.Exception.message)]`n`tCONTINUING...`n"
            }
        }
1 Like