Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get-Histogram - $Data vs Pipeline #2

Open
lansalot opened this issue Jan 14, 2019 · 3 comments
Open

Get-Histogram - $Data vs Pipeline #2

lansalot opened this issue Jan 14, 2019 · 3 comments

Comments

@lansalot
Copy link

Your examples at https://github.com/nicholasdille/PowerShell-Statistics

PS C:\> $Processes = Get-Process
PS C:\> $Histogram = $Processes | Get-Histogram -Property WorkingSet64 -BucketWidth 50mb -BucketCount 10

cmdlet Get-Histogram at command pipeline position 1
Supply values for the following parameters:
Data[0]:
Get-Histogram : Cannot validate argument on parameter 'Data'. The argument is null, empty, or an element of the
argument collection contains a null value. Supply a collection that does not contain any null values and then try the
command again.
At line:1 char:14
+ ... Processes | Get-Histogram -Property WorkingSet64 -BucketWidth 50mb -B ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Get-Histogram], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Get-Histogram

Don't work - appears the cmdlet is expecting input via $Data instead of the pipeline.

@nicholasdille
Copy link
Owner

My bad. I realized that some cmdlets should not support the pipeline because they cannot process in a stream but rather need to work on the data as a whole.

I will keep this open as a reminder to fix the examples!

@lansalot
Copy link
Author

No worries - thanks for Get-Histogram, that saved me a bit of coding! :)

@kundeng
Copy link

kundeng commented Nov 11, 2019

It seems the following doesn't work:
Get-Histogram -InputObject $Processes -Property WorkingSet64 -BucketWidth 50mb -BucketCount 10

But it works with -InputObject omitted.

This is different from the documentation says:

-InputObject <Array>
    {{Fill InputObject Description}}
    
    Required?                    true
    Position?                    named
    Default value                None
    Accept pipeline input?       True (ByValue)
    Accept wildcard characters?  false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants