Solved

How can I change the display lenght in PowerShell?

Posted on 2010-08-21
7
1,474 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
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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 70

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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

This article explains in simple steps how to renew expiring Exchange Server Internal Transport Certificate.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this video we show how to create a Distribution Group 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 Recipients >>…
To show how to create a transport rule 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 >> Rules tab.:  To cr…

815 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

12 Experts available now in Live!

Get 1:1 Help Now