microsoft / Microsoft-Win32-Content-Prep-Tool

A tool to wrap Win32 App and then it can be uploaded to Intune
993 stars 209 forks source link

Not able to create intunewin file - Faulting module KERNELBASE.dll with exception code 0xe0434352 #129

Open raavikr12c opened 3 months ago

raavikr12c commented 3 months ago

I'm encountering an issue with IntuneWinAppUtil.exe (version 6.2006.10) executed from my VB.NET code on Windows Server 2022 (21H2 Build: 20348.2527). Despite previous functionality, it now fails to generate the intunewin file.

I have a Windows service running under a service account that constantly checks for requests to create intunewin files. Recently some enhancements were made to this service, integrated into the same DLL as the code invoking IntuneWinAppUtil.exe.

Code Snippet ProcessPath = "D:\temp\IntuneWinAppUtil.exe | -c \\{some network path}\Temp1\ -s setup.exe -o \\{some network path}\Temp2 -q"

Public Shared Function CreateIntunewinFile(ByVal ProcessPath As String) As Boolean
    Dim b As Boolean = True
    Try
        Dim objProcess As System.Diagnostics.Process
        Dim iPos As Integer = ProcessPath.IndexOf("|")
        Dim ExecuteCmd As String = Mid(ProcessPath, 1, iPos - 1)
        Dim CmdParams As String = Trim(Mid(ProcessPath, iPos + 2, Len(ProcessPath)))
        Dim procinfo As New System.Diagnostics.ProcessStartInfo(ExecuteCmd, CmdParams)
        procinfo.WindowStyle = ProcessWindowStyle.Hidden
        procinfo.CreateNoWindow = True
        procinfo.UseShellExecute = False
        Try
            objProcess = New System.Diagnostics.Process()
            Try
                objProcess.StartInfo = procinfo
                objProcess.Start()
                objProcess.WaitForExit()
            Finally
                objProcess.Close()
            End Try
        Catch ex As Exception
            ErrorMsg = "Error: " + ex.Message
            b = False
        End Try
    Finally
    End Try
    Return b
End Function

Problem Details IntuneWinAppUtil.exe executes successfully from CMD and also on my local PC using the same parameters and setup. However, when run on the server through my code, it consistently fails. I have attempted to resolve this by using the latest version of the executable (6.2404.13.0), but the issue persists.

Error Messages I observe the following errors in Event Viewer:

Application Error:

i) Faulting application name: IntuneWinAppUtil.exe, version: 6.2006.10.0, time stamp: 0x5ea32335 Faulting module name: KERNELBASE.dll, version: 10.0.20348.2520, time stamp: 0x72149c73 Exception code: 0xe0434352 Fault offset: 0x000000000003f17c Faulting process id: 0x2350 Faulting application start time: 0x01dad06218da38f5 Faulting application path: D:\temp\IntuneWinAppUtil.exe Faulting module path: C:\windows\System32\KERNELBASE.dll Report Id: 92eddb1d-43a7-4c3a-95df-8c9b6828ae1a Faulting package full name: Faulting package-relative application ID:

ii) Faulting application name: IntuneWinAppUtil.exe Version: 6.2404.13.0 Timestamp: 0xa9f45829 Faulting module name: KERNELBASE.dll Version: 10.0.20348.2520 Timestamp: 0x72149c73 Exception code: 0xe0434352 Fault offset: 0x000000000003f17c Faulting process id: 0x6e4 Faulting application start time: 0x01dad069ebcb84fe Faulting application path: D:\temp\IntuneWinAppUtil.exe Faulting module path: C:\windows\System32\KERNELBASE.dll Report Id: 57e901ea-df05-4c14-9b03-5fbde2c085db

.Net Runtime Error:

Application: IntuneWinAppUtil.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.IO.IOException at System.IO.__Error.WinIOError(Int32, System.String) at System.Console.SetBufferSize(Int32, Int32) at System.Console.set_BufferHeight(Int32) at Microsoft.Management.Service.IntuneWinAppUtil.LogUtil..cctor()

Exception Info: System.TypeInitializationException at Microsoft.Management.Service.IntuneWinAppUtil.LogUtil.WriteLineForError(System.Object, Boolean) at Microsoft.Management.Service.IntuneWinAppUtil.Program.Main(System.String[])

I have ensured that the service account used has "Log on as a service" permissions on the server. Additionally, this account has appropriate permissions on all relevant folders and paths, confirmed by verifying its presence in the Security tab of folder properties.

Any insights or suggestions on resolving this issue would be greatly appreciated. Please let me know if there are any issues with my code or configuration as the code is working fine in my local pc but not in server.

ameltzer-MSFT commented 2 weeks ago

This appears to be due to the executable assuming there's a console in place and throwing an exception when trying to manipulate that console. There were several issues fixed around this in the previous build, but you may have found a particular scenario that was not fixed.

83 could help address this by eliminating all console output, however we'll also look into seeing if there's any additional changes that can be made to further help here.