Hi Nandhini A,
Thank you replied back to us after reviewing your question
Based up on your script could you please go through this document once Windows Server health check script here that could assist in performing a comprehensive health check on your system. This script is designed for system health, including logs, performance metrics, and recent events. you have to customize the script implement add the input parameters accordingly
If an answer has been helpful, please consider accepting the answer to help increase visibility of this question for other members of the Microsoft Q&A community.