cashonly
cashonly

Reputation: 119

How can I prevent the Powershell Invoke-sqlcmd truncating output at 80 columns?

eIn Powershell, Invoke-sqlcmd is truncating my output at 80 columns

I've tried this code and things are still being truncated at the 80th column

$ans=Invoke-Sqlcmd -ServerInstance $sqlServer -Database $MyDbName -Query $SQLSCRIPT -OutputAs DataTables |Format-Table -Property * -AutoSize | Out-String -Width 4096 | Out-File $FullPathReportFileName

How can I keep it from truncating and looking like this?:

Upvotes: 1

Views: 1226

Answers (1)

js2010
js2010

Reputation: 27626

What does the output look like? The way it looks on the screen is kind of an illusion. If you pipe to format-list, or select -expand property, it will probably show the whole thing. You might like this setting:

$formatenumerationlimit = 99

Or increase the size of the window.

Upvotes: 1

Related Questions