![]() $Checks = Running the monitoring with PowerShell script Both are scriptblocks run by Invoke-Command within the Invoke-ServerCheck function. Every condition should return a Boolean value.Īdding new checks is as easy as adding a new top-level key with a sub-key of check and condition. There are many ways to structure a potential script to do server checks, but this tutorial will place all checks in a hashtable that uses scriptblocks, which makes it easy to run the code on the requested computers, either local or remotely.Īdditionally, the script uses a condition key and associated scriptblock to report whether the check has passed or failed. This function will take the XML files and generate different formats based on the requested report type, either daily or monthly. ![]() This function will take in a series of checks and computers to run those scripts against, then export the results to an XML file. To do this, we will create functions in the PowerShell script. The overall idea behind this server monitoring framework is to run a series of checks on one or more servers, save the results and then review the findings. Script structure for server monitoring with PowerShell Check licensed states and report any that are unlicensed. Compile a list of certificates that are within 30 days of expiration. ![]() If it is, then the server OS predates Windows Server 2012, 20 and is no longer supported by Microsoft. ![]() Checking if the version number is lower than 6.2. Checking local disks and triggering a warning if the percentage of free space goes below 10%. While there are many server checks you can perform, this article will concentrate on just a few to demonstrate the capabilities of a simple PowerShell monitoring framework. While PowerShell 7 is available, this tutorial is based on Windows PowerShell 5.1 due to the ease of its default PowerShell remoting setup process. This article explores how to create a simple framework for Windows Server checks with the added benefit of generating reports at different intervals to assist with your monitoring efforts.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |