PowerTip: Change PowerShell to Display More Info by Default

Doctor Scripto

Summary: Change Windows PowerShell so that it will display more information by default.

Hey, Scripting Guy! Question I pipe information and select certain properties, but the information in my table is truncated. Using Autosize or Wrap does not help. How can I change Windows PowerShell so that it displays the information contained in the property?

Hey, Scripting Guy! Answer You are running into $FormatEnumerationLimit. By default, it is set to 4, but by changing it to a higher number, you can force Windows PowerShell to display additional information. The default behavior is shown here:

PS C:\> Get-Service -Name winmgmt | ft name, DependentServices -AutoSize

Name    DependentServices

—-    —————–

winmgmt {wscsvc, vmms, SUService, SharedAccess…}

 PS C:\> $FormatEnumerationLimit

4

By assigning a new value to $FormatEnumerationLimit, the remaining DependentServices is displayed. This technique is shown here:

PS C:\> $FormatEnumerationLimit = 8

PS C:\> Get-Service -Name winmgmt | ft name, DependentServices -AutoSize -Wrap

 Name    DependentServices

—-    —————–

winmgmt {wscsvc, vmms, SUService, SharedAccess, LocationTaskManager, NcaSvc,

        iphlpsvc, IAStorDataMgrSvc}

Note  The value of $FormatEnumerationLimit exists only during the current session. To make the change persist through opening and closing the Windows PowerShell session, or even to survive a reboot, add the new value assignment to your Windows PowerShell profile.

 

0 comments

Discussion is closed.

Feedback usabilla icon