Get-ADUser in UDTable

Hi there,

how can i get the following code / values into a UDTable. The table shall show the value of $user.Surname

$users = get-aduser -Filter * -Properties Surname, Displayname, emailaddress | sort displayname | select surname, displayname ,emailaddress
foreach($user in $users) {
$user.Surname
}

I despair of it.

Thanks!!

Hi TiX,

You should check out, https://www.poshud.com or the documentation at https://docs.universaldashboard.io/ they are great reousrces and have fantastic examples to help you with future problems.

This being said, that should be pretty easy to do.

New-UDTable -Title "ADUser" -Header @("Surname", "DisplayName", "EmailAddress") -Endpoint {
    Get-ADUser -Filter * -Properties Surname, Displayname, emailaddress | sort displayname | select surname, displayname ,emailaddress | Out-UDTableData -Property @("Surname", "DisplayName", "EmailAddress")
    }
} 

Hope that helps
-Obie

2 Likes

I thought too complicated :smirk:

thx