Solved

How can I change the display lenght in PowerShell?

Posted on 2010-08-21
7
1,515 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 6

Assisted Solution

by:DewFreak
DewFreak earned 50 total points
ID: 33491894
0
 
LVL 13

Accepted Solution

by:
soostibi earned 300 total points
ID: 33492488
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
ID: 33493059
find the below steps 1, then 2

1.png
2.png
0
Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

 
LVL 12

Assisted Solution

by:Mahmoud Sabry
Mahmoud Sabry earned 100 total points
ID: 33493166
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
ID: 33494084
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 71

Assisted Solution

by:Chris Dent
Chris Dent earned 50 total points
ID: 33500485

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
ID: 33507537
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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
How to resolve IMCEAEX NDRs in Exchange or Exchange Online related to invalid X500 addresses.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

752 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