Exploring the Find-Package Cmdlet from the PowerShell version 5 Preview OneGet Module

While presenting on the OneGet Module in the preview version of PowerShell version 5 for the Mississippi PowerShell User Group last week I discovered a couple of things about the Find-Package cmdlet that I wanted to share.

The first thing is wildcards don’t work with the name parameter:


That’s seems to be because they’re already performing a wildcard search as I’ll search for ‘Java’ in the following example and notice that none of the packages are that exact name. Some contain other words before the word Java, some contain words afterwards, and some contain words before and afterwards so searching for Java effectively searches for *Java*. You’ll also notice the search was not case sensitive:


You may think that the previous search contains all of the results for packages with Java in their name? That assumption would be incorrect. Adding the -MinimumVersion parameter returns more results and you would think it would return fewer results:


You might think that you’ll out smart it and specify all versions from .1 to 100 to return everything, but that won’t return anything:


I thought this may be because MinimumVersion might want an integer, but checking the help for that parameter shows it expects a string:


Specifying 0 or even 0.1 returns what you would expect:


There’s an easier way to accomplish the task of returning all versions though, by using the -AllVersions parameter:


A few days ago I meantioned being overwheled if you ran the Find-Package cmdlet without any parameters. That returned 1751 packages:


Adding this newly discovered -AllVersions parameter returns 7691 packages:


There’s a -IncludePrereleaseVersions parameter, but adding that parameter returned the same number of packages as the previous command:


There’s also a -Hint parameter which is interesting but also a bit mysterious and I’m still working on figuring out this parameter as it’s not as self explanatory as the others:



I’ve written several blog articles about the OneGet module during the past week so be sure to take a look at them for more information about the new features in the preview version of Powershell version 5.


1 Comment

  1. Stefan StrangerS

    Hi Mike,

    When doing some tests with the Hint Parameter it seems that using that parameter is using the Skip Token System Query Option in the query to the PackageSource.


    But I only see the skiptoken when not using in combination with the Name parameter.

    This needs some more clarification I guess 🙂



Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: