Want to ensure your computers and devices are always connected and working without having to install third-party software or even script files? In this guide, we’ll walk you through setting up a simple “heartbeat” monitoring system using PowerShell and Windows Scheduler—all without the need for extra software or agents.
The approach is straightforward: we’ll create a PowerShell script that pings a small piece of information to the PingMyThing API at regular intervals. This way, you’ll know if your computers are up and running or if there’s a problem that needs your attention. Let’s get started!
Overview of the Heartbeat Monitor Setup
Heartbeat monitoring helps keep track of whether a machine is online and functioning properly. This solution does not require any third-party installers or script files and can be deployed across a network, allowing you to start monitoring potentially thousands of devices in just a matter of minutes. By scheduling a PowerShell script to send a “heartbeat” signal to a server at regular intervals, you can easily monitor your machines without complex setups. We’ll make use of Windows Task Scheduler and the PingMyThing API to automate the sending of a GUID and status values.
What you need to do:
- Create a simple PowerShell script.
- Add it to Windows Task Scheduler.
- Deploy it across your network using Group Policy (GP).
Step 1: The PowerShell Script
The core of the heartbeat monitoring system is a PowerShell script that sends data to the PingMyThing API (pmtapi.net). To get started, all you need is a GUID, which you receive by email when you subscribe for a 30-day free trial (no card details required). We’ll keep it very simple here:
powershell.exe -Command "&{
try {
irm 'https://pmtapi.net:8000/v2/' -Method Post -Body (
$b=@{
guid='YOUR_GUID_HERE';
stn=$env:COMPUTERNAME;
sens=1;
val=1
} | ConvertTo-Json -Compress
) -ContentType 'application/json';
exit 0
}
catch {
(Get-Date -Format 'g') + '`r`n' + $_ | Out-File 'C:\PMT_heartbeat_error.txt' -Append;
exit 1
}
}"
Explanation of Each Part:
powershell.exe -Command "&{ ... }": Runs PowerShell and executes the script inside.try { ... } catch { ... }: Catches any errors and logs them to a text file.irm 'https://pmtapi.net:8000/v2/' -Method Post -Body ...:irm(Invoke-RestMethod) sends a POST request to the PingMyThing API.$b=@{...}|ConvertTo-Json -Compress: Creates a data body containing:guid: A unique identifier for your computer.stn: The computer name.sens=1andval=1: Status values indicating a heartbeat (always on).
catch { ... }: Logs any errors toPMT_heartbeat_error.txt.
Step 2: Adding to Windows Task Scheduler
Now that we have our script, let’s make sure it runs automatically.
- Open Task Scheduler: Press
Win + R, typetaskschd.msc, and press Enter. - Create a New Task: Select Create Task from the right-hand panel.
- Name the Task: Give it a descriptive name, like “Heartbeat Monitor for PingMyThing”.
- Set the Trigger: Click on the Triggers tab, add a new trigger, and set it to repeat every 5 minutes (or whatever interval suits your needs).
- Add the Action: In the Actions tab, click New and set the following:
- Action: Start a program.
- Program/script:
powershell.exe - Add arguments: Copy and paste the PowerShell script command above.
- Configure for All Users: Under the General tab, make sure “Run whether user is logged on or not” is selected.
- Choose the Account to Run the Script: Set the Security options to use the SYSTEM account.
Step 3: Rolling Out Using Group Policy
- Open Group Policy Management Console (GPMC): Press
Win + R, typegpmc.msc, and press Enter. - Create or Edit a GPO: Create a new Group Policy Object (GPO) or edit an existing one.
- Add the Scheduled Task: Navigate to
Computer Configuration > Preferences > Control Panel Settings > Scheduled Tasks. - Create a New Scheduled Task: Use the same settings as in Step 2.
- Link the GPO: Ensure it’s linked to the Organizational Units (OUs) that contain the computers you want to monitor.
Step 4: Checking Machine Status
To check which machines are online, use PowerShell:
irm "https://pmtapi.net:8080/v2/advanced-query/?guid=YOUR_GUID_HERE&latest=1" | Format-Table
For machines currently online, add &val=eq1 to the URL:
irm "https://pmtapi.net:8080/v2/advanced-query/?guid=YOUR_GUID_HERE&latest=1&val=eq1" | Format-Table
For machines currently offline, use &val=eq0:
irm "https://pmtapi.net:8080/v2/advanced-query/?guid=YOUR_GUID_HERE&latest=1&val=eq0" | Format-Table
Quick Graphical View
For a graphical view of your online/offline machines, open the following URL in your browser:
https://pmtapi.net:8080/report1/?guids=YOUR_GUID_HERE
Replace YOUR_GUID_HERE with your actual GUID.
Wrapping Up
You now have a simple and effective heartbeat monitoring system—one that doesn’t need third-party software, agents, or script files. This solution can be used across your network to monitor thousands of devices efficiently. Once the scheduler is set up, it will work from anywhere, as long as the device has a network connection. You’ll know right away if something goes wrong, giving you peace of mind knowing that every machine in your network is regularly sending a signal that says, “I’m alive!”