Start a Conversation

Unsolved

This post is more than 5 years old

D

1328

August 31st, 2017 11:00

PowerShell HistoricalFilter syntax

I am attempting to write a PowerShell script to extract certain statistics.  An example of a command I am trying to use is Get-DellScServerHistoricalStorageUsage.  However, I cannot figure out how to format the parameter -HistoricalFilter.

Can someone provide me with an example?

TIA

1 Message

November 6th, 2017 17:00

I too had difficulty figuring out the HistoricalFilter parameter, but after looking through the PowerShell SDK Cookbook and web documentation provided with the SDK I was able to figure it out.

Running the "[DellStorage.Api.Enums.FilterTimeEnum]::GetList()" command below will list the available values for the FilterTimeEnum -

Value Description Name    
----- ----------- ----    
    0 Other           Other   
    1 LastDay       LastDay 
    2 LastWeek    LastWeek
    3 LastMonth   LastMonth

I then followed the examples in the Powershell SDK Cookbook to set the following-

$filter = [DellStorage.Api.Enums.FilterTimeEnum] "LastDay"

And then used that as part of my command -

Get-DellScControllerHistoricalIoUsage -HistoricalFilter $filter

You can also use the filter in conjunction with the "New-DellHistoricalFilter" cmdlet. My example grabs data from the last hour -

$startdate = (Get-Date).AddHours(-1)

$finishdate = (get-date)

$lasthour = New-DellHistoricalFilter -FilterTime $filter -StartTime $startdate -EndTime $finishdate

Get-DellScControllerHistoricalIoUsage -HistoricalFilter $lasthour

Hopefully this helps!

No Events found!

Top