Problem with result length

Hey everyone, i’m having an issue with a result from a get-aduser.

 

I’m trying to setup a script to see what aliases are setup on a user in my AD, but the result i get are truncated and i can’t see the full result.

 

here’s my script for now:

[pre]

Function get-proxy
{
$proxy = get-aduser #my user# -properties proxyaddresses | Select-Object proxyaddresses | Format-table -wrap
$proxy}

get-proxy [/pre]

I’m seeing this result :

[pre]

{x500:/o=First Organization/ou=Exchange Administrative Group *LOTS of infos here
*********************************************, smtp:My first real alias, smtp:my second real alias…}

[/pre]

I know there are at least two more aliases beginning with “smtp:” but they don’t appear here and i think its because of the length of the results

 

Thanks in advance for the help :slight_smile:

Get-ADUser returns an object and the proxyaddresses property is a collection, so you can do something like this to expand and display the results.

Get-ADUser -Identity user -Properties proxyaddresses |Select-Object -ExpandProperty proxyaddresses |
Foreach-Object {
    [pscustomobject]@{
        ProxyAddresses = $_
    }
}

Or if you just need values, you can just drop that last foreach-object block and have it just output the raw values.

You can also modify the default format truncation with $FormatEnumerationLimit as described here.

Also as a tip you should leave out the Format-Table -Wrap from your function, its better to do these things outside the function.
You might want to use the data in another way later on, and then you will be limited by having Format-Table in the function.

Thanks for the answer and the several tips everyone this is exactly what i needed :slight_smile:

Once again this community is the best :slight_smile: