I am trying to pull last 7 days of data from today's date from LTM using powershell script. Instead of inserting the specific start time and end time, I am trying to do it automatically to get data from 7 days back up till today. So far I have tried following.
$Query = New-Object -TypeName iControl.SystemStatisticsPerformanceStatisticQuery
$Query.object_name = "throughput"
$Query.start_time = (get-date).AddDays(-7)
$Query.end_time = get-date
$Query.interval = 0
$Query.maximum_rows = 0
but I am getting a following error:
Exception setting "start_time": "Cannot convert value "2/22/2017 12:26:35 PM" to type "System.Int64". Error: "Invalid cast from 'DateTime' to 'Int64'.""
At line:1 char:1
+ $Query.start_time = (get-date).AddDays(-7)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], SetValueInvocationException
+ FullyQualifiedErrorId : ExceptionWhenSetting