Setting up Alerting on HWiNFO64

Categories Technology

Step 1. Write PowerShell script to send email to yourself

The first step in setting up alerting for HWiNFO64 is to write a PowerShell script (.ps1) that sends a customized email to your email address or phone number. Here are the parameters that will need to be set for this script:

$EmailFrom = Enter the email address from which the message will originate from. Place in quotations (“”).

Note: The email address in this field does not have to be one that is active. You can use a dummy email address (ex. “alerts@braedensantos.com”)

$EmailTo = Enter the email address which the message will be sent to. Place in quotations (“”).

You must enter a valid email address. If you want to set up email to SMS, here are the most common suffixes for the major mobile carriers

  • T-Mobile: [phone number]@tmomail.net
  • Verizon: [phone number]@vtext.net
  • AT&T: [phone number]@txt.att.net
  • Any other carrier: do a Google search for “email to SMS” for your appropriate carrier

$Subject = Subject line of your choice (Ex. “ALERT: High CPU Temp on [Computer Name]”). Place in quotations (“”).

$Body = The main content of your email. Place in quotations (“”).

Ex. “The CPU Package Temperature on BRAEDEN-GAMING has reached 85 degrees Celsius or higher. Please take the immediate action to resolve this alert.”

$SMTPServer = URL of the SMTP server that will send the email over to your recipient. Place in quotations (“”). Here are the SMTP servers for the most common email services:

                Gmail: smtp.gmail.com

                Office 365: smtp.office365.com

                Outlook Online: smtp.outlook.com

                Yahoo: smtp.mail.yahoo.com

                Any other service: look up the SMTP address for your appropriate email carrier

$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587)

                Leave port number 587 at end as is, unless you are having a hard time sending email through.

$SMTPClient.EnableSsl = $true

                Leave this true unless you are having a hard time sending with SSL

$SMTPClient.Credentials = New-Object System.Net.NetworkCredential(“[Email address/username]”, “[Server password]”); Place both credentials in quotations (“”).

These are the credentials to get on to the SMTP server that you are sending the email from. These credentials will be used when sending the email over to your recipients.

$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)

Last line of the command is the actual command to send the email using the information provided on the previous lines.

When finished writing your script, please save this script in an appropriate location that will allow you to reference it easily. I recommend running this script afterwards to test the functionality of this PowerShell script to verify that the message is sent successfully. If it is not successful, you may have to tweak some settings such as the SMTP server, SMTP port, enabling/disabling SSL, and SMTP server credentials.

Step 2. Set up Batch script that calls PowerShell script to be executed

Since HWiNFO64 does not support the use of PowerShell scripts in their alerting (yet!), you will have to use a batch file to execute the PowerShell script that you have created and tested. The script consists of pretty much three lines:

@echo off

cd “Directory which you have stored the PowerShell script”

powershell.exe -command .\[PowershellScriptName.ps1]

Save the script as a batch (.BAT) file and test as necessary. I recommend saving this batch file on the same folder as the PowerShell script (.PS1) If not successful, you may need to tweak the script in order to make it work.

Step 3. Set Alerting on HWiNFO64

This is the third and final step in setting up alerting for HWiNFO64. First, you will need to open up HWiNFO64 as Sensors only, then click on the gear on the bottom right as shown in the screenshot below.

You will see a window that says “HWiNFO64 Sensor Settings”. Click on the Alerts tab, scroll down until you see CPU Package, and click on it. Below that, you will need to click the checkbox that says Enable Alerting. In addition, you will need to check off If value >= and enter the temperature in which you want to be notified that your CPU temp is high (I recommend setting it to 25 degrees lower than the TjMAX of your CPU).

After that, check off Run a Program and click on the field to the right of the checkbox. Here, you will navigate to the location which your batch file is located. Make sure you set the file type to Batch files so that you can see the actual file that you are opening with HWiNFO64.

Lastly, you will need to set two settings: Notification distance (which is how often the notification will occur) and Samples to trigger alarm (how many times event will occur before notification). I recommend the Notification distance to be set as 120 seconds (or every two minutes) and Sample to trigger alarm as 2. Click OK once you are finished with configuration.

Step 4. Test alert using a CPU benchmark such as Prime95

After configuration, the final step is to test the alert using a CPU benchmarking program such as Prime95. This will ensure that your CPU temperature will be as high to the point where an alert will be generated by HWiNFO64.

If you need Prime95, the latest version can be downloaded at https://www.mersenne.org/download/.

NOTE: RUN THIS PROGRAM AT YOUR OWN RISK!!! THIS PROGRAM IS DESIGNED TO TEST THE LIMITS OF YOUR CPU. I AM NOT RESPONSIBLE FOR ANY DAMAGE TO YOUR COMPUTER BUILD CAUSED BY THIS PROGRAM SHOULD IT OCCUR.  

After opening up Prime95, you want to select the Small FFTs mode, which is designed to generate the most amount of heat on the CPU needed to test the alert function. Keep the number of threads the same and click OK to start the test. After starting the test, your CPU temperature should spike to approximately 60 degrees Celsius, eventually making 85 degrees and above. Below is a screenshot of HWiNFO64 with a CPU usage of around 85 degrees.

At this point is when you should receive the notification on your email or your phone if you have set up SMS that the computer’s CPU package temperature has reached the threshold to alert. Keep in mind that the alert will take a little bit to generate, as we set the Sample to trigger alarm to 2. Here are the notifications that I have received in my Outlook inbox and on my phone’s SMS application.

If you keep Prime95 running, you will receive the same notification every two minutes or however long you set your notification distance to be. Once you are certain that your alerts are working and that you feel that it is no longer appropriate to run Prime95 anymore, simply stop the test. I do not recommend running this program for long periods of time unless you are testing the stability of your computer.

If you have not received any email notifications at this point, your issue would likely lie within the HWiNFO64 settings. Please be sure that your batch file is properly tied to the program and that you have set the threshold limits correctly.

Conclusion

Now that I have showed you how to set up notifications on HWiNFO64 for your CPU Package temps, you can use the same tutorial to set up alerts for other sensors. For each sensor that you set a notification for, you should have a different PowerShell and Batch script with the customized messages to send to your email address or phone. If, for any reason, you have any questions regarding any part of this tutorial, do not hesitate to contact me using the contact form.