?
Solved

How can I change the display lenght in PowerShell?

Posted on 2010-08-21
7
Medium Priority
?
1,553 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 200 total points
ID: 33491894
0
 
LVL 13

Accepted Solution

by:
soostibi earned 1200 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 400 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 400 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 200 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

Are You Ready for GDPR?

With the GDPR deadline set for May 25, 2018, many organizations are ill-prepared due to uncertainty about the criteria for compliance. According to a recent WatchGuard survey, a staggering 37% of respondents don't even know if their organization needs to comply with GDPR. Do you?

Question has a verified solution.

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

How to deal with a specific error when using the Enable-RemoteMailbox cmdlet to create a mailbox in the cloud-based service, for an existing user in an on-premises Active Directory.
On September 18, Experts Exchange launched the first installment of the Help Bell, a new feature for Premium Members, Team Accounts, and Qualified Experts. The Help Bell will serve as an additional tool to help teams increase question visibility.
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…
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…

719 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