Forum Discussion
WSHvly01
Feb 07, 2024Copper Contributor
Script Output Format
The scripts I create normally have output on what it's doing and the status of it. I put the script under the Software Library Workspace > Scripts section. After running the script on a computer, I notice that the output of my script do not have any carriage returns or line feeds. Does anyone know how to get them to display? A simple test I did was use this script:
Write-Host "1"
Write-Host "2`r`n"
Write-Host "3"
Write-Output "4"
Write-Output "5`r`n"
Write-Output "6"
The output shows like this:
1 2 3 ["4","5\r\n","6"]
- Garth-MVPIron ContributorMy guess is they are being stripped out to allow for the script results to be showed nicely when run against a collection. Why problem requires multiple lines?
- WSHvly01Copper Contributor
The script outputs what it's doing, so that's why it has multiple lines. It's normal for a script to have multiple lines of output.
- Garth-MVPIron ContributorI'm going to disagree with you. Almost all non interactive scripts only have one output as there is no way for ConfigMgr or LANDesk or ... To determine the results.