Reputation: 53
I'm trying to get the UIDNumbers out of all my AD users and after that determining the highest UIDNumber with the following code
Get-ADUser -Filter * -property UIDNumber | Select-Object UIDNumber | measure -maximum
This results in the following:
Count : 1867
Average :
Sum :
Maximum :
Minimum :
Property :
Weird since i don't get the right value in "Maximum" a lot of values are empty as well fyi.
Upvotes: 0
Views: 6315
Reputation: 25021
Since you are passing an object rather than a scalar into Measure-Object
, you need to pick the property that you want to measure with the -Property
parameter.
Get-ADUser -Filter "UIDNumber -like '*'" -Property UIDNumber |
Measure-Object -Maximum -Property UIDNumber
Select-Object
is not necessary since the Get-ADUser -Property UIDNumber
returns objects that already contain UIDNumber
. However, if you use the -ExpandProperty UIDNumber
parameter of Select-Object
, you do not need to specify -Property
in Measure-Object
.
Upvotes: 2