Out-String doesn't work in Universal Dashboard

Out-String doesn't work in Universal Dashboard

Product: PowerShell Universal - Any Version 
Issue:
Out-String does not appear to work in PowerShell Universal Dashboard running in Windows PowerShell v5.1. You will receive empty strings when attempting to use Out-String. See the example below for an example of this issue. 

New-UDDashboard -Title "Hello, World!" -Content {
    $Processes = Get-Process | Out-String
    New-UDCard -Content {
        New-UDElement -tag 'pre' -Content {
            $Processes
        }
    }
}


Resolution:
The Out-String -Width parameter is defaulting to 0 which is causing no output to be shown. Set the -Width parameter to a large value to see output. See the below example for a resolution.

New-UDDashboard -Title "Hello, World!" -Content {
    $Processes = Get-Process | Out-String -Width 10000
    New-UDCard -Content {
        New-UDElement -tag 'pre' -Content {
            $Processes
        }
    }
}

    • Related Articles

    • PowerShell Universal Service crashes on startup after an upgrade to 1.4.6

      Version: PowerShell Universal 1.4.6 Issue The PowerShell Universal service will crash with the following error in Event Viewer.  Application: Universal.Server.exe CoreCLR Version: 4.700.19.56402 .NET Core Version: 3.1.0 Description: The process was ...
    • KB0021 - Unable to update Dashboard Pages in PowerShell Universal 3.6.4

      Purpose Due to an issue with the client-side application in PowerShell Universal 3.6.4, you may experience a problem updating page content. When clicking the Save button, a toast message would be shown that states that a 400 HTTP error had occurred. ...
    • KB0035 - How to add the Calendar and other components

      Purpose The purpose of this article is to demonstrate how to install and use the Calendar component (module) Background There is a growing list of add-on components (modules) for PowerShell Universal at ...
    • Dashboard does not start

      Version: PowerShell Universal 2.x Problem: When attempting to start a dashboard, the dashboard either reports Start Failed or does not transition from Stopped.  Root Cause and Resolution: There can be multiple root causes for this issue. Each root ...
    • PowerShell Universal crashes after upgrade to 1.5

      Version: 1.5 Issue: The PowerShell Universal service will not start properly when upgrading from 1.4 to 1.5. The following error is shown in the log.  Unhandled exception. System.InvalidCastException: Unable to cast object of type ...