If you do a Get-Member on the object returned by ADSISearcher, you will find that it returns two properties: Path and Properties. If you want to get the samAccountName from it, you need to specify $User.Properties.samAccountName
Thanks for the response. I added $user.Properties.SamAccountName, and the SamAccountName column is still empty.
by ArtB0514 at 2013-03-04 11:49:46
Well, you can always use the GetDirectoryEntry method as you did for the AccountDisabled property, or just use $_.SamAccountName, since the name in the csv file and the name in the directory must be the same.
by GMB1 at 2013-03-04 12:04:22
$_.SamAccountName worked! Thanks, ArtB0514!
The topic ‘Powershell output file missing SamAccountName results’ is closed to new replies.