#Create array for all accounts to be stored in

accounts = @()

#Get-AdUser cmdlet to filter on sAMAccountName and only search for enabled account and then store each one in the array
Get-AdUser -filter {sAMAccountName -Like “jeff*” -and enabled -eq $true} | select-object sAMAccountName | Foreach-Object{$accounts += $_.samaccountname}

#Echo all accounts returned in the array
$accounts | Sort-Object

#Give a count of the items in the array
$accounts.Coun