How to Fix IntuneWinAppUtil.exe Crashes with “System.ArgumentOutOfRangeException” Error

Problem

In the new Windows Terminal, the app crashes when trying to update the progress bar:

PS> .\IntuneWinAppUtil.exe -c “c:\install” -s “install.msi” -o “c:\output” -q
Validating parameters
Validated parameters with 14 milliseconds
Compressing the souce folder ‘C:\install\’ to ‘…filename.intunewin’
Calculated size for folder ‘C:\install’ is 74907648 with 1 milliseconds
Compressed folder ‘C:\install’ successfully with 3451 milliseconds
Checking file type
Checked file type with 185 milliseconds
Encrypting file ‘…filename.intunewin’

                                              ]   42%

System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console’s buffer size in that dimension.
Parameter name: targetTop
Actual value was 124.
at System.Console.MoveBufferArea(Int32 sourceLeft, Int32 sourceTop, Int32 sourceWidth, Int32 sourceHeight, Int32 targetLeft, Int32 targetTop, Char sourceChar, ConsoleColor sourceForeColor, ConsoleColor sourceBackColor)
at Microsoft.Management.Service.IntuneWinAppUtil.LogUtil.PrintProgress(AppContext context)
at Microsoft.Management.Service.IntuneWinAppUtil.LogUtil.WriteLine(AppContext context, String text)
at Microsoft.Management.Service.IntuneWinAppUtil.PackageUtil.CreatePackage(String folder, String setupFile, String outputFolder, String catalogFolder)
at Microsoft.Management.Service.IntuneWinAppUtil.Program.Main(String[] args)

Solutions

Workaround for the Windows 22H2 and Windows 11:
In the new Windows 11 it will default open everything in Terminal, even CMD.exe, but you can change this in the Terminal Settings:

Click on the Downward arrow and go to settings.

Then at Default Terminal application choose Windows Console Host and save that.
From there on out you can run cmd.exe in the old way.