Reputation: 103
When using Format-Table, PowerShell will replace ellipsis if the width of the screen is reached, even if you use -AutoSize option of Format-Table.
gci -Path 'C:/ProgramData/Paessler/PRTG Network Monitor/Logs' -Include '*.*' -Recurse -ea SilentlyContinue `
| Format-Table -Property CreationTimeUtc, Length, FullName -AutoSize
Output:
CreationTimeUtc Length FullName
--------------- ------ --------
26.11.2021 06:04:11 136 C:\ProgramData\Paessler\PRTG Network Monitor\Logs\...
26.11.2021 06:04:11 21118 C:\ProgramData\Paessler\PRTG Network Monitor\Logs\...
26.11.2021 06:06:18 109 C:\ProgramData\Paessler\PRTG Network Monitor\Logs\...
26.11.2021 06:06:18 1355 C:\ProgramData\Paessler\PRTG Network Monitor\Logs\...
26.11.2021 06:04:11 35629 C:\ProgramData\Paessler\PRTG Network Monitor\Logs\...
26.11.2021 05:59:20 2956 C:\ProgramData\Paessler\PRTG Network Monitor\Logs\...
How can I avoid that ellipsis being displayed instead of my data?
Upvotes: 0
Views: 564
Reputation: 103
You can tell add Out-String -Width NNN to control the width of your printouts
gci -Path 'C:/ProgramData/Paessler/PRTG Network Monitor/Logs' -Include '*.*' -Recurse -ea SilentlyContinue `
| Format-Table -Property CreationTimeUtc, Length, FullName -AutoSize `
| Out-String -Width 1024
Output:
CreationTimeUtc Length FullName
--------------- ------ --------
26.11.2021 06:04:11 136 C:\ProgramData\Paessler\PRTG Network Monitor\Logs\core\Core.log
26.11.2021 06:04:11 21118 C:\ProgramData\Paessler\PRTG Network Monitor\Logs\debug\currConfiguration.logcfg
26.11.2021 06:06:18 109 C:\ProgramData\Paessler\PRTG Network Monitor\Logs\probe\Probe.log
26.11.2021 06:06:18 1355 C:\ProgramData\Paessler\PRTG Network Monitor\Logs\serveradmin\ServerAdmin.log
26.11.2021 06:04:11 35629 C:\ProgramData\Paessler\PRTG Network Monitor\Logs\AdvMetaLog_core.log
26.11.2021 05:59:20 2956 C:\ProgramData\Paessler\PRTG Network Monitor\Logs\PRTG_GlobalLoggingConfiguration.logcfg
Obviously, if it no longer fits the screen width, it is possible that the data will now show with line breaks. That is a feature of whatever tool you are using to see the results of running your script. But the data is correct. Your tool displaying the data is getting into the picture adding the carriage returns to show the data (as opposed to truncating it).
Upvotes: 1