0

I'm trying to make some GUI using SAPIEN PowerShell Studio. My goal is to display list of users with creation dates, and so far I have this:

$arrLastCreatedUsers = @(Get-ADUser -Filter * -Properties Created | Select-Object name,Created | Sort-Object Created);

$listbox_LastCreatedUsers.DataSource = $arrLastCreatedUsers;

If i do it in cli, output looks like what i wanted to see, but when it comes to output to listbox, every string looks like that:

@{name=name1; Created=Sun, 10.10.2012 16:09:40}
@{name=name2; Created=Sun, 10.10.2012 16:09:43}
@{name=name3; Created=Sun, 10.10.2012 16:09:46}
@{name=name4; Created=Sun, 10.10.2012 16:09:48}
@{name=name5; Created=Sun, 10.10.2012 16:09:50}

It isn't what i want to see, of course... so what should i do?

1 Answer 1

1

When using objects as data, you need to specify which member will be displayed. If you don't do that, it will use $obj.toString() to get the value that it shows in the list(which is what you have atm.). Try this:

$listbox_LastCreatedUsers.DisplayMember = "name";
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.