microsoft / CSS-Exchange

Exchange Server support tools and scripts
MIT License
1.22k stars 340 forks source link

[Issue] - Health Checker Script failing to complete due to invalid applicationHost.config file. #2017

Closed SoniaChen66 closed 5 months ago

SoniaChen66 commented 7 months ago

Provide Version Number Version 24.02.15.1640

Describe the issue When Run the script HealthChecker.ps1 Version 24.02.15.1640, to see where our Exchange server was at. However it only gave me the output: Exchange Health Checker version 24.02.15.1640 Failed to Health Checker against Server01 Failed to Health Checker against Server01

and If I run the previous version HealthChecker.ps1 Version 23.12.08.2252, it runs correctly on the Exchange server mentioned above.

Expected behavior The script would start running the health checker and build the Report.

Script Output Exchange Health Checker version 24.02.15.1640 Failed to Health Checker against Server01 Failed to Health Checker against Server02

thmeyer-msft commented 7 months ago

@SoniaChen66 - Could you please provide us the HealthChecker-Debug_.txt log

SoniaChen66 commented 7 months ago

I have sent the file HealthChecker-Debug_.txt log Is there any follow-up news?

lusassl-msft commented 7 months ago

@SoniaChen66 it looks like the script fails when it processes the IIS Web App Pools. Thanks for sharing the debug log. Would it be possible to share the HealthChecker-Errors.json with us as well?

Thanks

SoniaChen66 commented 7 months ago

I have already mailed it. Thanks

dpaulson45 commented 7 months ago

Linking this to issue #1885 as we want to improve the error handling within the analyzer code where if we have successfully completed to pull all the required data, then an exception occurs we want the following to happen:

  1. Data Collection is export out to XML
  2. If possible, continue with the data analysis and display to the screen.
dpaulson45 commented 7 months ago

For this issue, we are failing to complete the script because we are unable to convert the applicationHost.config file to an xml document.

值轉換為 "System.Xml.XmlDocument" 型別。錯誤: "'<' (十六進位值 0x3C) 是無效的屬性字元。 行 700,位置 13。"
Inner Exception:    於 System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
   於 System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
   於 System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   於 System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   於 System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
   於 System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
   於 System.Management.Automation.PSScriptCmdlet.RunClause(Action`1 clause, Object dollarUnderbar, Object inputToProcess)
   於 System.Management.Automation.PSScriptCmdlet.DoEndProcessing()
   於 System.Management.Automation.CommandProcessorBase.Complete()
Position Message: 位於 C:\HealthChecker.ps1:4776 字元:5
+     $iisLocations = ([xml]$applicationHostConfig).configuration.Locat ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Script Stack: 位於 Invoke-AnalyzerIISInformation,C:\HealthChecker.ps1: 第 4776 行
位於 Invoke-AnalyzerEngine,C:\HealthChecker.ps1: 第 8759 行
位於 Get-HealthCheckerData,C:\HealthChecker.ps1: 第 15578 行
位於 Invoke-HealthCheckerMainReport,C:\HealthChecker.ps1: 第 15659 行
位於 <ScriptBlock><End>,C:\HealthChecker.ps1: 第 16470 行
位於 <ScriptBlock>,<無檔案>: 第 1 行

Translate: The value is converted to type "System.Xml.XmlDocument". Error: "'<' (hexadecimal value 0x3C) is an invalid attribute character. Line 700, position 13.

@SoniaChen66 is this server functional for Exchange for client protocols? Based off this, it seems like it wouldn't be.

SoniaChen66 commented 7 months ago

I'm sorry, may I ask which settings I should check on the host?

dpaulson45 commented 7 months ago

@SoniaChen66 when I have an invalid applicationHost.config file, I can't open IIS Manager and expand Site the information properly without receiving an error. I also can't connect EMS to the local server that is having this issue.

image

image

This isn't the same error, but I would expect similar results because we do expect to be able to convert the file to an XmlDocument type.

SoniaChen66 commented 7 months ago

I just tried to edit the applicationHost.config file. I only opened the applicationHost.config file without making any edits, then closed the file. After re-running HealthChecker, the file worked properly and generated a report. I'm not sure why? image

In the environments of my other clients, it is also the same.

dpaulson45 commented 7 months ago

When was the last modification time of the applicationHost.config file?

SoniaChen66 commented 7 months ago

I saved the file after editing it today, but I didn't make any changes to the file. image

tn919871 commented 7 months ago

Encountered the same issue. Tried accessing and editing, then saved without making any changes, but the latest version of the HC still doesn't work properly.

HC ver 23.12.08.2252 run error message:

Frequent Configuration Issues

    TCP/IP Settings: Not Set
            Error: Without this value the KeepAliveTime defaults to two hours, which can cause connectivity and performance issues between network devices such as firewalls and load balancers depending on their configuration.
            More details: https://aka.ms/HC-TcpIpSettingsCheck
    RPC Min Connection Timeout: 0
            More Information: https://aka.ms/HC-RPCSetting
    FIPS Algorithm Policy Enabled: 0
    CTS Processor Affinity Percentage: 0
    Disable Async Notification: 0
    Credential Guard Enabled: False
    EdgeTransport.exe.config Present: True
    Open Relay Wild Card Domain: Not Set
    DisablePreservation:
    **Invalid Configuration File:
            Invalid: C:\Windows\system32\inetsrv\config\applicationHost.config**
    HSTS Enabled: False
dpaulson45 commented 5 months ago

@tn919871 is not going to work if the applicationHost.config file is not a valid xml file.

Did you fix your applicationHost.config file? Are you able to launch IIS Manager?

dpaulson45 commented 5 months ago

This issue appears to be the same as #2027.

Issue was caused by encoding on the system. After saving, without making any changes, the issue goes away.