Home > Enterprise >  Powershell Get-ADUser select return {}instead of values
Powershell Get-ADUser select return {}instead of values

Time:12-22

When I do a get-aduser followed by a select, some columns returns the value {} (or "Microsoft.ActiveDirectory.Management.ADPropertyValueCollection" when I do an export to CSV file).

The command is the following one:

Get-ADUser -properties * | select Surname,LastName,FullName,DisplayName

And the values returned:

| Surname  | LastName       | Fullname | DisplayName    |
| -------- | -------------- | -------- | -------------- |
| John     | {}             | {}       | John Doe (User)|

CodePudding user response:

Try replacing "LastName" with "GivenName" and "Fullname" with just "Name".

I have tried and for me it works this way.

Get-ADUser "YourSearch" -properties * | select Surname,GivenName,Name,DisplayName

CodePudding user response:

Using this @{N='o';E={$_.o[0]}} and by using the correct names for the attributes I was able to extract the informations I needed.

  • Related