Link to home
Start Free TrialLog in
Avatar of whorsfall
whorsfallFlag for Australia

asked on

Powershell Format-List problem

Hi,

I am running the following powershell command:


get-alert | where {$_.ResolutionState -eq 0 } | Format-List MonitoringObjectDisplayName,Name,ResolutionState,RepeatCount,TimeRaised


Which displays the following:

MonitoringObjectDisplayName : SQL1
Name                        : The SQL Server Service Broker or Database Mirroring
                               transport is disabled or not configured
ResolutionState             : 0
RepeatCount                 : 1
TimeRaised                  : 20/11/2007 6:41:23 PM

The problem is the TimeRaised field is no in LocalTime, it is GMT time I suspect. I want to convert it
to my local time. (In my case GMT+10) if I try the following it does not work

get-alert | where {$_.ResolutionState -eq 0 } | Format-List MonitoringObjectDisplayName,Name,ResolutionState,RepeatCount,TimeRaised.ToLocalTime()


MonitoringObjectDisplayName : SQL1
Name                        : The SQL Server Service Broker or Database Mirroring
                               transport is disabled or not configured
ResolutionState             : 0
RepeatCount                 : 1

** No TimeRaised field **

Any suggestions on the syntax to make this work?

Thanks,

Ward
ASKER CERTIFIED SOLUTION
Avatar of BSonPosh
BSonPosh
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
FYI: For more info on Calculated Properties look at help for format-table (it works the same.)
PS> get-help format-table -full
I just saw your post on NG :)