Parameter set cannot be resolved

Welcome Forums General PowerShell Q&A Parameter set cannot be resolved

Viewing 4 reply threads
  • Author
    Posts
    • #183333
      Participant
      Topics: 2
      Replies: 4
      Points: 1
      Rank: Member

      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,

    • #183342
      Participant
      Topics: 0
      Replies: 21
      Points: 136
      Helping Hand
      Rank: Participant

      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 ]`

    • #183348
      Participant
      Topics: 2
      Replies: 4
      Points: 1
      Rank: Member

      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,

       

    • #183363
      Participant
      Topics: 2
      Replies: 4
      Points: 1
      Rank: Member

      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

    • #183369
      Participant
      Topics: 2
      Replies: 4
      Points: 1
      Rank: Member

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

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

      Thank you,

       

Viewing 4 reply threads
  • You must be logged in to reply to this topic.