New-TimeSpan cmdlet in powershell -
how can use new-timespan cmdlet calculate total time taken script execution.i tried sample this.
$val=get-date $start=new-timespan -start $val $val2=get-date $end=new-timespan -end $val2 $diff=new-timespan -start $start -end $end
but ended following error: new-timespan : cannot bind parameter 'start'. cannot convert "00:00:08.7110000" value of type "system.timespan" type "system.datetime".
you don't need use new-timespan
subtract datetime
objects:
$script_start = get-date start-sleep -seconds 5 $script_end = get-date $script_end - $script_start
this create timespan
object.
Comments
Post a Comment