I am using v2019.3.1 LTS. I had some process that use powershell to do the works, and sometimes it will generate error, and that error message was wrapped due to powershell width.
I ran $host.UI.RawUI.BufferSize and it is showing the default width is 80. When I add this line before outputing the error message($Host.UI.RawUI.BufferSize = New-Object Management.Automation.Host.Size (500, 25)) , I get the desired output message in one line.
I reading from this post(Powershell script output line wrap) that the buffer size should be already in 500. How can I change the default width so that I don’t have to add the ($Host.UI.RawUI.BufferSize = New-Object Management.Automation.Host.Size (500, 25)) to every powertshell step?
Thanks for reaching out. A long time ago (~2012) we used to spin up our own powershell host each time we ran scripts. That proved to be very painful to maintain and not too beneficial, so we switched to just running our scripts using the PS host of the VM instead. This means that the PS session we run will use the same $host config that comes with your VM/user session.