Parameter set cannot be resolved

I’m getting an error on this line:

$ProPackageFullName = (Get-AppxProvisionedPackage | where {$_.Displayname -like "$App"}).PackageName
This is the error:
Get-AppxProvisionedPackage : Parameter set cannot be resolved using the specified named parameters. At E:\Dnload\Sysprep\RemoveAllAppxPackages3.ps1:28 char:28 + $ProPackageFullName = (Get-AppxProvisionedPackage | where {$_.Dis ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Get-AppxProvisionedPackage], ParameterBindingException
Please suggest a solution for me.

Running in win 10 1903

Thanks,

There are 2 parameter sets. Both have required parameters. You probably want the -Online option.

`Get-AppxProvisionedPackage -Path [-WindowsDirectory ] [-SystemDrive ] [-LogPath ] [-ScratchDirectory ] [-LogLevel ]`

`Get-AppxProvisionedPackage -Online [-WindowsDirectory ] [-SystemDrive ] [-LogPath ] [-ScratchDirectory ] [-LogLevel ]`

I’m not sure that will give me the package name?

Maybe I should have included the entire script? The error is on line 29.

# This will Remove all Appxpackages # $AppsList = 'Microsoft.3DBuilder', 'Microsoft.BingFinance', 'Microsoft.BingNews', 'Microsoft.BingSports', 'Microsoft.MicrosoftSolitaireCollection', 'Microsoft.People', 'Microsoft.Windows.Photos', 'Microsoft.WindowsCamera', 'microsoft.windowscommunicationsapps', 'Microsoft.WindowsPhone', 'Microsoft.WindowsSoundRecorder', 'Microsoft.XboxApp', 'Microsoft.ZuneMusic', 'Microsoft.ZuneVideo', 'Microsoft.Getstarted', 'Microsoft.WindowsFeedbackHub', 'Microsoft.XboxIdentityProvider', 'Microsoft.MicrosoftOfficeHub', 'Fitbit.FitbitCoach', 'ThumbmunkeysLtd.PhototasticCollage', 'Microsoft.People', 'Netflix'

#Start-Transcript -Path ‘E:\Dnload\Sysprep\RemoveAllAppxPackages.txt’ -append
ForEach ($App in $AppsList){
$PackageFullName = (Get-AppxPackage -AllUsers “$App”).PackageFullName
$ProPackageFullName = (Get-AppxProvisionedPackage | where {$_.Displayname -like “$App”}).PackageName
$PackageFullName | out-File -FilePath E:\Dnload\Sysprep\RemoveAllAppxPackages.txt -Append
$ProPackageFullName | out-File -FilePath E:\Dnload\Sysprep\RemoveAllAppxPackages.txt -Append
if ($PackageFullName){
“Removing Package: $App” | out-File -FilePath E:\Dnload\Sysprep\RemoveAllAppxPackages.txt -Append
remove-AppxPackage -package $PackageFullName -AllUsers | out-File -FilePath E:\Dnload\Sysprep\RemoveAllAppxPackages.txt -Append
}

else{
“Unable to find package: $App” | out-File -FilePath E:\Dnload\Sysprep\RemoveAllAppxPackages.txt -Append
}

if ($ProPackageFullName){
“Removing Provisioned Package: $ProPackageFullName” | out-File -FilePath E:\Dnload\Sysprep\RemoveAllAppxPackages.txt -Append
Remove-AppxProvisionedPackage -online -packagename $ProPackageFullName | out-File -FilePath E:\Dnload\Sysprep\RemoveAllAppxPackages.txt -Append
pause
}

else{
“Unable to find provisioned package: $App” | out-File -FilePath E:\Dnload\Sysprep\RemoveAllAppxPackages.txt -Append
pause
}
}
Pause
#Stop-Transcript
:: To remove just the one package causing the problem, use I used the following line:
::C:\Batch\psexec -s powershell -c “Get-AppxPackage -all | where name -eq “APP.NAME” | Remove-AppxPackage”


Thank you,

 

With the script suggestion you provided:

$ProPackageFullName = `Get-AppxProvisionedPackage -Online [-WindowsDirectory ] [-SystemDrive ] [-LogPath ] [-ScratchDirectory ] [-LogLevel ]`
I'm getting this error:
Get-AppxProvisionedPackage : A positional parameter cannot be found that accepts argument '[-WindowsDirectory'. At E:\Dnload\Sysprep\RemoveAllAppxPackages3.ps1:29 char:28 + ... eFullName = `Get-AppxProvisionedPackage -Online [-WindowsDirectory ] ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Get-AppxProvisionedPackage], ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.Dism.Commands.GetAppxProvisionedPackageCommand

I figured out the answer. This line seems to work:

$ProPackageFullName = (Get-AppxProvisionedPackage -online | where {$_.Displayname -eq $App}).PackageName
Thank you,