Closed felixstorm closed 3 years ago
I have big problems running this from PowerShell too. It looks like writing the progress bar causes more problems than it solves 😢. Can the progress bar be disabled when running non-interactively, i.e. when using the -q
switch?
I too am having the same issues. This is integrated in a script but returns this error. Just launching it in its own window without parameters works fine, but that is not the reason that I am scripting :)
Running this in Azure DevOps, we're hitting a similar/the same issue:
Unhandled Exception: System.TypeInitializationException: The type initializer for 'Microsoft.Management.Service.IntuneWinAppUtil.LogUtil' threw an exception. ---> System.IO.IOException: The handle is invalid. | Â
-- | --
 |  | Â
 | at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) | Â
 | at System.Console.GetBufferInfo(Boolean throwOnNoConsole, Boolean& succeeded) | Â
 | at System.Console.get_BufferWidth() | Â
 | at Microsoft.Management.Service.IntuneWinAppUtil.LogUtil..cctor() | Â
 | --- End of inner exception stack trace --- | Â
 | at Microsoft.Management.Service.IntuneWinAppUtil.LogUtil.WriteLineForError(Object error) | Â
 | at Microsoft.Management.Service.IntuneWinAppUtil.Program.Main(String[] args)
I use this workaround by running it in its own PowerShell console :
$Command = "$WorkingDir\$IntuneWinAppUtil -c `"$SourceFolder`" -s `"$SourceFileName`" -o $WorkingDir -q"
$Bytes = [System.Text.Encoding]::Unicode.GetBytes($Command)
$EncodedCommand =[Convert]::ToBase64String($Bytes)
Start-Process PowerShell.exe -ArgumentList "-EncodedCommand $EncodedCommand" -Wait
Calling the tool using
Start-Process -Wait $intunewinapputil "-q -c `"$sourceFolder`" -s `"$itwSetupFile`" -o `"$outputFolder`""
also seems to work for us (it will also open a new console without output redirection).
Might be fixed with the latest release?
Fixed the ArgumentOutOfRangeException error when running the tool in Windows Terminal.
Issue: https://github.com/microsoft/Microsoft-Win32-Content-Prep-Tool/issues/29
@wiseleaf23 No, unfortunately the error is still the same, even with the latest release (1.8). A problem has been fixed for Windows Terminal, but output redirection does still not seem to work.
This seems to be a problem in general if you run this through powershell. For example we have Execute.ps1 that does:
& "$PSScriptRoot\..\..\tools\Microsoft-Win32-Content-Prep-Tool-1.8.1\IntuneWinAppUtil.exe" -c "$tmp\in" -s "installer.msi" -o "$tmp\out" -q
And it blows up with:
Unhandled Exception: System.TypeInitializationException: The type initializer for 'Microsoft.Management.Service.IntuneWinAppUtil.LogUtil' threw an exception. ---> System.IO.IOException: The handle is invalid.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.Console.SetBufferSize(Int32 width, Int32 height)
at System.Console.set_BufferHeight(Int32 value)
at Microsoft.Management.Service.IntuneWinAppUtil.LogUtil..cctor()
--- End of inner exception stack trace ---
at Microsoft.Management.Service.IntuneWinAppUtil.LogUtil.WriteLineForError(Object error)
at Microsoft.Management.Service.IntuneWinAppUtil.Program.Main(String[] args)
Even under 1.8.1
:(
Are there any workaround for this? I have tried the ones listed above but does not work in an Azure Function environment.
@jonatanhost we run it in cmd and the problem isn't there
Does anyone have a workaround for this?
I have also tried the ones listed above but it does not work in an Azure Function environment.
@nikyusof ?
The tool crashes if the output is being redirected. Output of
IntuneWinAppUtil -c SomeSample -s Setup.exe -o . -q > test.log
:This is problematic if the tool is being included in automatic (CI) systems when there is no way for the output to be captured (especially in conjunction with https://github.com/microsoft/Microsoft-Win32-Content-Prep-Tool/issues/4)