Want to fill two column array, and sort it on second column to display. Can someone assist me ?
$scopelist = Get-DhcpServerv4Scope | sort name
write-host -foregroundcolor green "Aantal scopes : " $scopelist.count
$allscopes=@(85),@(2)
$teller=0
foreach ($scope in $scopelist)
{
#write-host $scope.name " : " (Get-DhcpServerv4Lease $scope.scopeid).count
$all += (Get-DhcpServerv4Lease $scope.scopeid).count
$allscopes += $scope.name,(Get-DhcpServerv4Lease $scope.scopeid).count
#$allscopes[$teller][0]=$scope.name
#$allscopes[$teller][1]=(Get-DhcpServerv4Lease $scope.scopeid).count
$teller++
}
write-host "Alle toestellen via dhcp : " $all
$allscopes
#$gesorteerd = $allscopes | sort-object @{Expression={$_[1]}; Ascending=$false}
#$gesorteerd
now is output something like this :
Tournai
19
Turnhout
40
Users Wired
149
Users Wireless
46
Verviers
41
Veurne
18
WAP
10
Waregem
42
Wavre
25
Wetteren
33
Wevelgem
46
Zaventem
23
Zelzate
69
Zottegem
18
Zwevegem
42
$dictionary.GetEnumerator() | sort -Property value