I have code to output a sorted hashtable to the screen:
$h.getenumerator() | sort value -descending
It looks like this:
Name Value
---- -----
10.10.10.10 69566308 151
10.10.10.11 69566308 143
10.10.10.12 69566308 112
10.10.10.13 69566308 99
10.10.10.14 69566308 71
10.10.10.15 69566308 70
But I would like to output this to a file instead.
When I try to output to a file with
$h.getenumerator() | sort value -descending | out-string | Add-Content D:\Script\iis_stats.log
or
$h.getenumerator() | sort value -descending | Add-Content D:\Script\iis_stats.log
All I get is "System.Collections.DictionaryEntry" in D:\Script\iis_stats.log.
How do I fix it?