The $_ is required, because you are performing the Format-List on each item
in pipeline.
Do date diff try something like this
Format-List MonitoringObjectDisplayName, Name, ResolutionState, RepeatCount,@{l='TimeDifference';e={($_.TimeRaised.ToLocalTime()).Subtract($_.TimeRaised)}}
Brandon Shell
---------------
Blog:
http://www.bsonposh.com/
PSH Scripts Project:
www.codeplex.com/psobject
W> Hal / Kiron,
W>
W> Thanks great explinations.
W>
W> So does that mean that:
W>
W> get-alert | where {$_.ResolutionState -eq 0 } | Format-List
W> MonitoringObjectDisplayName, Name, ResolutionState, RepeatCount,
W> $(TimeRaised.ToLocalTime())
W>
W> would work as well?
W>
W> And how to extend the example a bit better if I am allowed to ask, is
W> there an easy way I can get a datediff between that calculated date
W> and the current date and time?
W>
W> Thanks,
W>
W> Ward
W>