microsoft / CSS-Exchange

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

[Issue] - Health Checker -HtmlReportFile does not overwrite #2026

Closed daepunt closed 7 months ago

daepunt commented 7 months ago

Provide Version Number Provide the version of the script that has the issue. v24.02.15.1640

Describe the issue A clear and concise description of the issue. When running .\HealthChecker.ps1 -BuildHtmlServersReport the default report file ExchangeAllServersReport.html is not overwritten if it already exists. Instead, a unique filename with timestamp is created and there is no mention of this. Even when I supply the parameter -HtmlReportFile C:\Scripts\ExchangeAllServersReport.html the behaviour stays the same. The command line mentions HTML Report Location: C:\Scripts\ExchangeAllServersReport.html, but the content of the existing file is the same, so nothing changes.

Expected behavior A clear and concise description of what you expected to happen. I would expect the script to either overwrite the existing file (espcially with the -HtmlReportFile parameter supplied) or at least to report to the command line that the file already exists and therefore the supplied filename is ignored. if an -Overwrite parameter could be added, I would be happy to use it. I am using the script to gather several reports and compile them into an email. Reusing the same filename makes it easier to gather everything.

Script Output If applicable, add the exception that wasn't handled.

Additional context Add any other context about the problem here.

lusassl-msft commented 7 months ago

@daepunt just to double check. If you execute the script like this, the content is not overwritten?

.\HealthChecker.ps1 -BuildHtmlServersReport -HtmlReportFile “ExchangeAllServersReport.html"

Note that HealthChecker will consume the latest .xml files, so if you run it twice using this command, it's expected that the content doesn't change because the existing .xml file is used.

daepunt commented 7 months ago

Nope, no difference. I'm not using any .xml file, though, Just running the script in single Exchange environment. Maybe that makes a difference.

dpaulson45 commented 7 months ago

@daepunt then you aren't running it correctly. It requires there to be .xml files to be generated prior to you running a new report. If the .xml file data doesn't change, neither will your .html data.

daepunt commented 7 months ago

Aaagh! There it is. I thought it was possible to run the script and create reports at the same time. I'm running the script first, now, and then create the report. Thanks for pointing that out!

lusassl-msft commented 7 months ago

Question answered.