Solved

How can I change the display lenght in PowerShell?

Posted on 2010-08-21
7
1,423 Views
Last Modified: 2012-05-10
Hi,

Sometime when I execute cmd like get-mailbox to list info with OU, the OU did not show completely. It finish by "..."

How can I change the display lenght in PowerShell?
0
Comment
Question by:SAM2009
7 Comments
 
LVL 6

Assisted Solution

by:DewFreak
DewFreak earned 50 total points
Comment Utility
0
 
LVL 13

Accepted Solution

by:
soostibi earned 300 total points
Comment Utility
You have three options. Let's see the example with this command:

get-mailbox | format-table name, primarysmtpaddress, distinguishedname

Probaly the distinguishedname column does not fit into the screen.

First you can do is use the -wrap switch for format-table:

get-mailbox | ft name, primarysmtpaddress, distinguishedname -wrap

This will wrap the all the 'cells' of information that does not fit into its column. The problem with that is - as in this example - other columns have more space unneccessarily. So the second option is to overwrite the default columns widths:

get-mailbox | ft name, primarysmtpaddress, @{n="distinguishedname"; e={$_.distinguishedname}; w=70}

With this hashtable definition I set a new coulmn that has the same name as the original one (n=...), even the data is the same ({e=...}) but has a new width (w=...).

The third option is to output the result to the gridview:

Get-Mailbox | Select-Object name, primarysmtpaddress, distinguishedname | out-gridview

In this new grid window you can adjust the columnwidth by the mouse.
0
 
LVL 12

Assisted Solution

by:Mahmoud Sabry
Mahmoud Sabry earned 100 total points
Comment Utility
find the below steps 1, then 2

1.png
2.png
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 12

Assisted Solution

by:Mahmoud Sabry
Mahmoud Sabry earned 100 total points
Comment Utility
you can use the command

Start-Transcript c:\users.txt

after you run the Cmdlet, this will copy the output to the specified path, and you then can copy and paste files into excel
0
 
LVL 1

Author Comment

by:SAM2009
Comment Utility
Thank you guys for all your suggestions. I will try on Monday and let you know.

Also is  there a way to export the result directly to Excel?
0
 
LVL 70

Assisted Solution

by:Chris Dent
Chris Dent earned 50 total points
Comment Utility

Very easily:

Get-Mailbox | Export-Csv "SomeFile.csv"

You'll notice a type identifier in the first row (prefixed with #). You can drop that by using -NoTypeInformation:

Get-Mailbox | Export-Csv "SomeFile.csv" -NoTypeInformation

Chris
0
 
LVL 1

Author Closing Comment

by:SAM2009
Comment Utility
Cool! Thank you very much everybody.

The  combination of width parameter, display properties and export file option let me do what I need.
0

Featured Post

Do email signature updates give you a headache?

Do you feel like all of your time is spent managing email signatures? Too busy to visit every user’s desk to make updates? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Then, let Exclaimer solve all your email signature problems today!

Join & Write a Comment

Utilizing an array to gracefully append to a list of EmailAddresses
Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
In this video we show how to create an Address List in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Organization >> Ad…
In this video we show how to create an Accepted Domain in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Mail Flow >> Ac…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now