Home QuickTipps Bug Displaying Complete Results
 

Displaying Complete Results

By default, when there is not enough room in the console, PowerShell cuts off parts of result columns and shows incomplete results:

PS> Get–Help –Name Service

Name                              Category  Module                    Synopsis
––––                              ––––––––  ––––––                    ––––––––
Get–Service                       Cmdlet    Microsoft.PowerShell.M... Gets t...
New–Service                       Cmdlet    Microsoft.PowerShell.M... Create...
New–WebServiceProxy               Cmdlet    Microsoft.PowerShell.M... Create...
Restart–Service                   Cmdlet    Microsoft.PowerShell.M... Stops ...
Resume–Service                    Cmdlet    Microsoft.PowerShell.M... Resume...
Set–Service                       Cmdlet    Microsoft.PowerShell.M... Starts...
Start–Service                     Cmdlet    Microsoft.PowerShell.M... Starts...
Stop–Service                      Cmdlet    Microsoft.PowerShell.M... Stops ...
Suspend–Service                   Cmdlet    Microsoft.PowerShell.M... Suspen...
Connect–QADService                Cmdlet    QuestAD                   Connec...
Disconnect–QADService             Cmdlet    QuestAD                   Discon...
Get–NetFirewallServiceFilter      Function  NetSecurity               ...     
Set–NetFirewallServiceFilter      Function  NetSecurity               ...     

  Sometimes, part of the output is truncated because there is not enough horizontal space

How to Display Everything

There are a couple of things you can do to display complete results. The most intuitive and easiest way is to pipe the whole thing to Out-GridView:

  

Get-Help -Name Service | Out-GridView -Title 'the results are in'

But maybe you need the data in textual form. That's when headaches start to creep up:

Strange Text Effects - And What To Do About It

You can pipe the results to another cmdlet that turns on text wrapping so you do not miss anything:

  

# display results with word wrap
Get-Help -Name Service | Format-Table -Wrap

The result will now look like this:

PS> Get–Help –Name Service | Format–Table –Wrap

Name                              Category  Module                    Synopsis
––––                              ––––––––  ––––––                    ––––––––
Get–Service                       Cmdlet    Microsoft.PowerShell.Mana Gets the
                                            gement                    services
                                                                      on a    
                                                                      local or
                                                                      remote  
                                                                      computer.
New–Service                       Cmdlet    Microsoft.PowerShell.Mana Creates 
                                            gement                    a new   
                                                                      Windows 
                                                                      service.
New–WebServiceProxy               Cmdlet    Microsoft.PowerShell.Mana Creates 
                                            gement                    a Web   
                                                                      service 
                                                                      proxy   
                                                                      object  
                                                                      that    
                                                                      lets you
                                                                      use and 
                                                                      manage  
                                                                      the Web 
                                                                      service 
                                                                      in      
                                                                      Windows P
                                                                      owerShell
                                                                      .       
Restart–Service                   Cmdlet    Microsoft.PowerShell.Mana Stops   
                                            gement                    and then
                                                                      starts  
                                                                      one or  
                                                                      more    
                                                                      services.
Resume–Service                    Cmdlet    Microsoft.PowerShell.Mana Resumes 
                                            gement                    one or  
                                                                      more susp
                                                                      ended   
                                                                      (paused)
                                                                      services.
Set–Service                       Cmdlet    Microsoft.PowerShell.Mana Starts, 
                                            gement                    stops,  
                                                                      and     
                                                                      suspends
                                                                      a       
                                                                      service,
                                                                      and     
                                                                      changes 
                                                                      its prope
                                                                      rties.   

As you can see, this may still look ugly. Another resort is to turn the data to a list:

  

Get-Help -Name Service | Format-List

Now it looks like this:

PS> Get–Help –Name Service | Format–List

examples             : @{example=System.Management.Automation.PSObject[]}
inputTypes           : @{[email protected]{[email protected]{description=System.Management.Autom
                       ation.PSObject[]; uri=;
                       name=System.ServiceProcess.ServiceController,
                       System.String};
                       description=System.Management.Automation.PSObject[]}}
terminatingErrors    :
alertSet             : @{alert=System.Management.Automation.PSObject[]; title=}
syntax               : @{syntaxItem=System.Management.Automation.PSObject[]}
relatedLinks         : @{navigationLink=System.Management.Automation.PSObject[]
                       }
details              : @{verb=Get; noun=Service; name=Get–Service;
                       description=System.Management.Automation.PSObject[];
                       copyright=System.Management.Automation.PSObject[];
                       version=}
description          : {@{Text=The Get–Service cmdlet gets objects that
                       represent the services on a local computer or on a
                       remote computer, including running and stopped services.
                       }, @{Text=You can direct Get–Service to get only
                       particular services by specifying the service name or
                       display name of the services, or you can pipe service
                       objects to Get–Service.}}
parameters           : @{parameter=System.Management.Automation.PSObject[]}
nonTerminatingErrors :
returnValues         : @{[email protected]{[email protected]{description=System.Management.Aut
                       omation.PSObject[]; uri=;
                       name=System.ServiceProcess.ServiceController};
                       description=System.Management.Automation.PSObject[]}}
xmlns:maml           : http://schemas.microsoft.com/maml/2004/10
xmlns:command        : http://schemas.microsoft.com/maml/dev/command/2004/10
xmlns:dev            : http://schemas.microsoft.com/maml/dev/2004/10
xmlns:MSHelp         : http://msdn.microsoft.com/mshelp
Name                 : Get–Service
Category             : Cmdlet
Synopsis             : Gets the services on a local or remote computer.
Component            :
Role                 :
Functionality        :
PSSnapIn             :
ModuleName           : Microsoft.PowerShell.Management

examples             : @{example=System.Management.Automation.PSObject[]}
inputTypes           : @{[email protected]{[email protected]{description=System.Management.Autom
                       ation.PSObject[]; uri=; name=None};
                       description=System.Management.Automation.PSObject[]}}
terminatingErrors    :
alertSet             : @{alert=System.Management.Automation.PSObject[]; title=}
syntax               : @{[email protected]{name=New–Service;
                       parameter=System.Management.Automation.PSObject[]}}
relatedLinks         : @{navigationLink=System.Management.Automation.PSObject[]
                       }
details              : @{verb=New; noun=Service; name=New–Service;
                       description=System.Management.Automation.PSObject[];
                       copyright=System.Management.Automation.PSObject[];
                       version=}
description          : {@{Text=The New–Service cmdlet creates a new entry for
                       a Windows service in the registry and in the service
                       database. A new service requires an executable file
                       that executes during the service.
                       }, @{Text=The parameters of this cmdlet let you set the
                       display name, description, startup type, and
                       dependencies of the service.}}
parameters           : @{parameter=System.Management.Automation.PSObject[]}
nonTerminatingErrors :
returnValues         : @{[email protected]{[email protected]{description=System.Management.Aut
                       omation.PSObject[]; uri=;
                       name=System.ServiceProcess.ServiceController};
                       description=System.Management.Automation.PSObject[]}}
xmlns:maml           : http://schemas.microsoft.com/maml/2004/10
xmlns:command        : http://schemas.microsoft.com/maml/dev/command/2004/10
xmlns:dev            : http://schemas.microsoft.com/maml/dev/2004/10
xmlns:MSHelp         : http://msdn.microsoft.com/mshelp
Name                 : New–Service
Category             : Cmdlet
Synopsis             : Creates a new Windows service.
Component            :
Role                 :
Functionality        :
PSSnapIn             :
ModuleName           : Microsoft.PowerShell.Management

examples             : @{example=System.Management.Automation.PSObject[]}
inputTypes           : @{[email protected]{[email protected]{description=System.Management.Autom
                       ation.PSObject[]; uri=; name=None};
                       description=System.Management.Automation.PSObject[]}}

This way, you can see all data, but as a side-effect, since in list view there are no space constraints anymore, PowerShell may start to output a lot more data than before.

So if you used this approach, you would want to limit the data to the properties you are after:

  

Get-Help -Name Service | Format-List -Property Name, Category, Module, Synopsis

This is the result:

Name     : Get–Service
Category : Cmdlet
Synopsis : Gets the services on a local or remote computer.

Name     : New–Service
Category : Cmdlet
Synopsis : Creates a new Windows service.

Name     : New–WebServiceProxy
Category : Cmdlet
Synopsis : Creates a Web service proxy object that lets you use and manage the
           Web service in Windows PowerShell.

Surprise again: the property "Module" is missing! It was there when you used Format-Table!

The reason for this is: the true property name is not "Module", but "ModuleName", as you can see in Format-List without Select-Object. PowerShell preprocesses data and uses internal cheat sheets (ps1xml files) that can change the data presentation anyway they like. Frequently, the true property names are exchanged with presumingly more readible names. That's what occured here.

So this would be correct (replace "Module" with "ModuleName"):

  

Get-Help -Name Service | Format-List -Property Name, Category, ModuleName, Synopsis

And now the result looks like expected:

Name       : Get–Service
Category   : Cmdlet
ModuleName : Microsoft.PowerShell.Management
Synopsis   : Gets the services on a local or remote computer.

Name       : New–Service
Category   : Cmdlet
ModuleName : Microsoft.PowerShell.Management
Synopsis   : Creates a new Windows service.

Name       : New–WebServiceProxy
Category   : Cmdlet
ModuleName : Microsoft.PowerShell.Management
Synopsis   : Creates a Web service proxy object that lets you use and manage
             the Web service in Windows PowerShell.

Name       : Restart–Service
Category   : Cmdlet
ModuleName : Microsoft.PowerShell.Management
Synopsis   : Stops and then starts one or more services.

Name       : Resume–Service
Category   : Cmdlet
ModuleName : Microsoft.PowerShell.Management
Synopsis   : Resumes one or more suspended (paused) services.