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:

1Find-Package -Name *Java*


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:

1Find-Package -Name Java


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:

1Find-Package -Name Java -MinimumVersion 7.0


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:

1Find-Package -Name Java -MinimumVersion .1 -MaximumVersion 100


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

1help Find-Package -Parameter MinimumVersion


Specifying 0 or even 0.1 returns what you would expect:

1Find-Package -Name Java -MinimumVersion 0 -MaximumVersion 100


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

1Find-Package -Name Java -AllVersions


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:

1(Find-Package -AllVersions).count


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

1(Find-Package -AllVersions -AllowPrereleaseVersions).count


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:

1Find-Package -Hint Oracle -AllVersions


1Find-Package -Hint 'VideoLAN Organization'


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.