No matter the formatting or output method I am trying I am not able to get around task schedulers ability to truncate output at it's default column 80 UGH
I had tried
Get-CimInstance -computerName $glfServers -Class Win32_OperatingSystem | Sort-Object csName | Format-Table -Property $csName, $serverStatus, $totalVisibleMemorySize, $freePhysicalMemory, $memoryUsage, $freeSpaceInPagingFiles, $lastBootTime | Out-String -Width 120 | Out-File 'C:\Scripts\OutputFiles\ServerMemory\PyhsMem.txt'
I had tried Tee-object mostly so I could get output to both console and file only to discover that the task scheduler output would be different.
I tried all the usual suspects Format-Table -Autosize and Out-file and after days of searching I finally found the answer buried in another stackoverflow post.
I am going to post my resolution because it was a frustrating few days with no relief in sight. I just get to add this to one more thing I dislike about Windows Task Scheduler.
Eureka! I finally found the answer I was very close you need to use
-Streamto get around the truncation. So the final working code block looks like this: