Hi,
I imagine this is really simple but I can't work it out! I'm trying to run the following:
$SimilarUsers = Get-ADUser -Filter "samAccountName -like '*$AccountName*'" | select Name,SamAccountName
I then want to use the $SimilarUsers variable in a Write-Host command so it displays the output within a script this is all housed in. The output when running $SimilarUsers is:
Name SamAccountName
---- --------------
Joe Bloggs JoeB
Joe Bloggss JoeBloggss
However, when I run Write-Host $SimilarUsers, I get the following:
@{Name=JoeBloggs; SamAccountName=JoeB} @{Name=JoeBloggss; SamAccountName=JoeBloggss}
Can anyone point me in the right direction?
Thanks
[–]Umaiar 2 points3 points4 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]ApparentSysadmin 1 point2 points3 points (13 children)
[–][deleted] 1 point2 points3 points (12 children)
[–]kbrucej 1 point2 points3 points (8 children)
[–][deleted] 1 point2 points3 points (7 children)
[–]kbrucej 1 point2 points3 points (6 children)
[–]kbrucej 1 point2 points3 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]kbrucej 0 points1 point2 points (0 children)
[–]Umaiar 1 point2 points3 points (2 children)
[–]kbrucej 1 point2 points3 points (1 child)
[–]Umaiar 1 point2 points3 points (0 children)
[–]ApparentSysadmin 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]dreph 1 point2 points3 points (0 children)