Powershell output file in txt file don't have all columns

Mario2286 441 Reputation points
2021-03-05T09:22:33.513+00:00

I was executing this Powershell command below to get DB backup history

$SQLServer = Get-Content -Path "C:\shell\cdms.txt"
Invoke-DbaQuery -sqlinstance $SQLServer -File "C:\shell\sqladmin.sql"| Out-File C:\shell\dmsDB_history2.txt

and this is the sql query

74679-backup-based-on-date-history-good.txt

and the results i get is as below
74680-image.png

supposed to be 7 columns but I can see only three columns and then 3 dot as I highlighted in yellow in output notepad file.

Please advice me how get all 7 columns in output file

It must have this 7 column below

74781-image.png

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,654 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,355 questions
0 comments No comments
{count} votes

Accepted answer
  1. Vaibhav Chaudhari 38,561 Reputation points
    2021-03-05T09:43:56.08+00:00

    Try adding width in the end

    Invoke-DbaQuery -sqlinstance $SQLServer -File "C:\shell\sqladmin.sql"| Out-File C:\shell\dmsDB_history2.txt -width 5000


    Please don't forget to Accept Answer and Up-vote if the response helped -- Vaibhav

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Rich Matheisen 44,696 Reputation points
    2021-03-05T15:57:23.107+00:00

    Instead of using "Out-File" why not use a CSV?

    Export-CSV C:\shell\dmsDB_history2.csv -NoTypeInfo
    
    0 comments No comments