F5F Stay Refreshed Power Users Networks What's happening with NCAT 7.4? It's giving me wrong numbers when I run it on my Windows 7 Pro 64-bit computer?

What's happening with NCAT 7.4? It's giving me wrong numbers when I run it on my Windows 7 Pro 64-bit computer?

What's happening with NCAT 7.4? It's giving me wrong numbers when I run it on my Windows 7 Pro 64-bit computer?

Z
Zach072999
Junior Member
29
04-21-2026, 06:02 AM
#1
Trying to check a network device with an old Windows 7 box (no screen or keyboard) so I can send an email if the connection stops working with smtpMail. Using NetCat on Linux gives zero when connected and something else when it's not ... trying this on Windows 7 with Ncat 7.4 always gives zero ... installing newer versions of NMAP/NCAT in W7 (7.92 and 7.93) fails. Pinging is too long and arp -a 192.168.0.100 seems to show a cached value. Are there other ways to tell programmatically if something disappeared from the network? Thanks for any help you can give me with Linux 10 buster (pi 4b) this shell script works on nc -zw1 192.168.0.100 80; then echo "connected" else echo "not connected" fi but from W7pro 64b with ncat 7.4 the following vbs script always returns zero (ExitCode):
DIM wshShell, oExec
Set wshShell = CreateObject ("WScript.Shell")
Set oExec = wshShell.exec("c:\temp\nmap\ncat.exe -zw1 192.168.0.100 80;")
Wscript.echo(oExec.ExitCode)
Z
Zach072999
04-21-2026, 06:02 AM #1

Trying to check a network device with an old Windows 7 box (no screen or keyboard) so I can send an email if the connection stops working with smtpMail. Using NetCat on Linux gives zero when connected and something else when it's not ... trying this on Windows 7 with Ncat 7.4 always gives zero ... installing newer versions of NMAP/NCAT in W7 (7.92 and 7.93) fails. Pinging is too long and arp -a 192.168.0.100 seems to show a cached value. Are there other ways to tell programmatically if something disappeared from the network? Thanks for any help you can give me with Linux 10 buster (pi 4b) this shell script works on nc -zw1 192.168.0.100 80; then echo "connected" else echo "not connected" fi but from W7pro 64b with ncat 7.4 the following vbs script always returns zero (ExitCode):
DIM wshShell, oExec
Set wshShell = CreateObject ("WScript.Shell")
Set oExec = wshShell.exec("c:\temp\nmap\ncat.exe -zw1 192.168.0.100 80;")
Wscript.echo(oExec.ExitCode)

H
HipsterTiger
Junior Member
21
04-28-2026, 05:21 AM
#2
Two questions: 1) Why does ping feel like too much jargon? Is it because we keep sending pings over and over? 2) How fast do you want an SMTP email reply if the connection stops or drops suddenly? You can check this with a quick PowerShell command that turns on quiet mode. If that check fails, your script can send an email right away. See the guide at https://petri.com/powershell-test-connection/ for more details and other useful links. Some of them might help you build something just like this to fit your needs.
H
HipsterTiger
04-28-2026, 05:21 AM #2

Two questions: 1) Why does ping feel like too much jargon? Is it because we keep sending pings over and over? 2) How fast do you want an SMTP email reply if the connection stops or drops suddenly? You can check this with a quick PowerShell command that turns on quiet mode. If that check fails, your script can send an email right away. See the guide at https://petri.com/powershell-test-connection/ for more details and other useful links. Some of them might help you build something just like this to fit your needs.

K
king_Rick_05
Member
180
04-28-2026, 06:25 AM
#3
I am still trapped in the old DOS world and trying to move into the new UNIX world, but I know PS exists. I just haven't found where to enter it yet. Here is a script I made based on your link. It looks like it works in PowerShell right now, but I need to make sure that contest.ps1 file gets called from an AutoHotKey script first.

The settings are all set to yes for the PS run policy:
$a = test-connection 192.168.0.100 -count 1 -quiet if ($a -eq $True) { echo "wahoo" } else{ echo "whoops" }

Ping results are getting too long because there are so many different ways to run a go-nogo test inside BAT files, and ncat in UNIX gives back 0 or -1. The command test-connection with the -quiet flag gives me exactly what I need but isn't easy for me to mix up scripts from PowerShell on the DOS side of Windows, which is where AutoHotKey lives.

The script loops forever until it stops, so it will check for lost connections once every five minutes. An email would be sent if the status changes to missing (only one email needed because AutoHotKey needs to remember the last poll status and only send a message when something new happens). The "Whoops" message would tell you urgently that a device is gone, while a Wahoo result would just say the connection is back. Basically, I need for AutoHotKey to run this PS1 script every five minutes.

I tried calling this PS1 script from a BAT file and it gave me nonsense like some repeating key AAAAA-AAAAA-AAAAA-AAAAA-AAAAA.
K
king_Rick_05
04-28-2026, 06:25 AM #3

I am still trapped in the old DOS world and trying to move into the new UNIX world, but I know PS exists. I just haven't found where to enter it yet. Here is a script I made based on your link. It looks like it works in PowerShell right now, but I need to make sure that contest.ps1 file gets called from an AutoHotKey script first.

The settings are all set to yes for the PS run policy:
$a = test-connection 192.168.0.100 -count 1 -quiet if ($a -eq $True) { echo "wahoo" } else{ echo "whoops" }

Ping results are getting too long because there are so many different ways to run a go-nogo test inside BAT files, and ncat in UNIX gives back 0 or -1. The command test-connection with the -quiet flag gives me exactly what I need but isn't easy for me to mix up scripts from PowerShell on the DOS side of Windows, which is where AutoHotKey lives.

The script loops forever until it stops, so it will check for lost connections once every five minutes. An email would be sent if the status changes to missing (only one email needed because AutoHotKey needs to remember the last poll status and only send a message when something new happens). The "Whoops" message would tell you urgently that a device is gone, while a Wahoo result would just say the connection is back. Basically, I need for AutoHotKey to run this PS1 script every five minutes.

I tried calling this PS1 script from a BAT file and it gave me nonsense like some repeating key AAAAA-AAAAA-AAAAA-AAAAA-AAAAA.

I
iTzPandaNuss
Member
144
04-28-2026, 11:33 PM
#4
"wahoo/whoops" is a decent start, but don't make changes just yet. Stick closely to the rules and what's already there. For example, if you see "True," echo that; otherwise, echo "False." This sends an email based on that result. It's simple but not very clear overall. I'd be clearer: say something like "Connected, DeviceName - OK" when everything is fine, or "Not Connected, DeviceName down" when it fails and send the email. Skip mixing in DOS or BAT files instead of using them. Do all this work with PowerShell commands. PowerShell can easily make timed loops that run specific actions at set times, plus it's easy to trigger an email whenever certain conditions happen (like if-then-else rules). Keeping it simple means checking for True or False values, but echoing those results like above helps show what happened. The variable $a might hold either a True value or a False one. After printing "No Connection Found," send the next command or maybe a function to do the rest of the job. You can find lots of links and examples online on timers and sending emails. There are many options here to explore.

= = = = Not sure if I need to use an auto hotkey. PowerShell scripts can start running when you open them, run from a desktop icon or task bar button, and also come in handy with Task Scheduler. == = = "Contest" mentioned above? Question: Are you trying to figure out when a website connection gets back on so you can send an email about a contest? That's different from watching for a device to go offline or lose its connection. Very probably, if that's the case, those contest websites will block automatic monitoring. They likely have rules in place to stop anyone from automatically checking just by sending pings. No True and no False needed here. Just wanted to share this info.
I
iTzPandaNuss
04-28-2026, 11:33 PM #4

"wahoo/whoops" is a decent start, but don't make changes just yet. Stick closely to the rules and what's already there. For example, if you see "True," echo that; otherwise, echo "False." This sends an email based on that result. It's simple but not very clear overall. I'd be clearer: say something like "Connected, DeviceName - OK" when everything is fine, or "Not Connected, DeviceName down" when it fails and send the email. Skip mixing in DOS or BAT files instead of using them. Do all this work with PowerShell commands. PowerShell can easily make timed loops that run specific actions at set times, plus it's easy to trigger an email whenever certain conditions happen (like if-then-else rules). Keeping it simple means checking for True or False values, but echoing those results like above helps show what happened. The variable $a might hold either a True value or a False one. After printing "No Connection Found," send the next command or maybe a function to do the rest of the job. You can find lots of links and examples online on timers and sending emails. There are many options here to explore.

= = = = Not sure if I need to use an auto hotkey. PowerShell scripts can start running when you open them, run from a desktop icon or task bar button, and also come in handy with Task Scheduler. == = = "Contest" mentioned above? Question: Are you trying to figure out when a website connection gets back on so you can send an email about a contest? That's different from watching for a device to go offline or lose its connection. Very probably, if that's the case, those contest websites will block automatic monitoring. They likely have rules in place to stop anyone from automatically checking just by sending pings. No True and no False needed here. Just wanted to share this info.

J
jaayk
Member
123
05-01-2026, 12:29 AM
#5
The little tricks in my example are just one thing called: FOO, BLAH, or FUBAR ... honestly, I never thought they would be used for real life anyway. AutoHotKey is perfect for simple tasks like controlling computers that don't have a keyboard or mouse attached. I have several unattended machines running different apps without any human to watch over them. AutoHotKey makes it easy to connect these apps together and make sure everything works well. The AutoHotKey functions let me access the Windows system API directly, which means I can see messages in the background of windows without writing complicated code in a low-level language like C. The specific functions I use are for: finding out which window is currently open, making sure all needed apps are running, clicking on buttons that are hidden or broken so they don't work (vendors hide those controls), resizing and moving windows, and removing unwanted extra windows. PowerShell could probably do any of these things too... but right now, I'd rather not have to rewrite or convert working scripts just because of one feature that only seems to exist in PowerShell. I haven't found a PowerShell example showing how to get back the answer when it runs from an AutoHotKey script. There are plenty of examples showing how to run a PS1 script from an BAT file... maybe PowerShell was never meant to return values? The ps1 scripts give answers within PowerShell, but those answers aren't returned when the PowerShell program ends up closed unlike a regular CMD shell where all these examples just give the same boring 25-character string every time when run from inside a BAT file with settings like: powershell -noprofile -ExecutionPolicy Bypass -Command "<path>\ttt.ps1" .\ttt.ps1. I think I might have to go back to using an old hacky way of working with files just in case... and when a file appears or disappears, AutoHotKey can send me an email message telling me about the connection result. Get the ps1 script to write or delete a special file based on what happened during that run.
J
jaayk
05-01-2026, 12:29 AM #5

The little tricks in my example are just one thing called: FOO, BLAH, or FUBAR ... honestly, I never thought they would be used for real life anyway. AutoHotKey is perfect for simple tasks like controlling computers that don't have a keyboard or mouse attached. I have several unattended machines running different apps without any human to watch over them. AutoHotKey makes it easy to connect these apps together and make sure everything works well. The AutoHotKey functions let me access the Windows system API directly, which means I can see messages in the background of windows without writing complicated code in a low-level language like C. The specific functions I use are for: finding out which window is currently open, making sure all needed apps are running, clicking on buttons that are hidden or broken so they don't work (vendors hide those controls), resizing and moving windows, and removing unwanted extra windows. PowerShell could probably do any of these things too... but right now, I'd rather not have to rewrite or convert working scripts just because of one feature that only seems to exist in PowerShell. I haven't found a PowerShell example showing how to get back the answer when it runs from an AutoHotKey script. There are plenty of examples showing how to run a PS1 script from an BAT file... maybe PowerShell was never meant to return values? The ps1 scripts give answers within PowerShell, but those answers aren't returned when the PowerShell program ends up closed unlike a regular CMD shell where all these examples just give the same boring 25-character string every time when run from inside a BAT file with settings like: powershell -noprofile -ExecutionPolicy Bypass -Command "<path>\ttt.ps1" .\ttt.ps1. I think I might have to go back to using an old hacky way of working with files just in case... and when a file appears or disappears, AutoHotKey can send me an email message telling me about the connection result. Get the ps1 script to write or delete a special file based on what happened during that run.

A
Ajax250
Junior Member
4
05-02-2026, 02:00 PM
#6
Reread your last 2 comments ... the ttt.ps1 or contest.ps1 scripts are ONLY monitoring local INTRANET IP's nothing Cloud based ... I have local devices that are highly susceptible to electrical noise (things like electric motors can introduce noise on power lines which in turn can disrupt cheap IOT devices requiring them to be rebooted) ... right now, even though these devices aren't critical, they are visible which means people start screaming at me when they notice they have failed ... this exercise will hopefully enable me to be ahead of the game so to speak. I recently deployed some ESP32 devices that allow me to remotely reboot some of these devices ... now I need a better way to determine when to reboot instead of either waiting for SCREAMS or having to periodically go and manually query the health of all devices.
A
Ajax250
05-02-2026, 02:00 PM #6

Reread your last 2 comments ... the ttt.ps1 or contest.ps1 scripts are ONLY monitoring local INTRANET IP's nothing Cloud based ... I have local devices that are highly susceptible to electrical noise (things like electric motors can introduce noise on power lines which in turn can disrupt cheap IOT devices requiring them to be rebooted) ... right now, even though these devices aren't critical, they are visible which means people start screaming at me when they notice they have failed ... this exercise will hopefully enable me to be ahead of the game so to speak. I recently deployed some ESP32 devices that allow me to remotely reboot some of these devices ... now I need a better way to determine when to reboot instead of either waiting for SCREAMS or having to periodically go and manually query the health of all devices.

T
TheCatHero19
Junior Member
22
05-04-2026, 12:32 AM
#7
Why don't we just put Mikrotik's "The Dude" thingy on that computer? It'll tell you about any stuff that shows up on the net and work like a log server.
T
TheCatHero19
05-04-2026, 12:32 AM #7

Why don't we just put Mikrotik's "The Dude" thingy on that computer? It'll tell you about any stuff that shows up on the net and work like a log server.

M
Mind_YT
Member
70
05-23-2026, 07:37 AM
#8
So here is what I found out. There isn't a built-in PowerShell way to catch when a program finishes running from a batch file. That's mostly because those two tools need each other; the batch file gives the result, then PowerShell reads it in like text and turns it into something useful. Sometimes getting that data can feel more like magic tricks than math—it's all about knowing what you're looking for. There are great ways to do this without needing a batch file at all. Also, check out this tool from The Dude by @nigelivey. It looks okay but I think it just lets you type commands and run scripts that can be done yourself easily. If you build your own script, you get more control and free tools if you change things later. Use Get-ComputerInfo to talk to computers on the network instead of relying on other software. The less tools you need is better. Now I'm curious: what are the top 5 items that a cheap IoT device dropped from the network or had to restart? So when something goes wrong, someone will get an email and stop the panic before it gets bad.
M
Mind_YT
05-23-2026, 07:37 AM #8

So here is what I found out. There isn't a built-in PowerShell way to catch when a program finishes running from a batch file. That's mostly because those two tools need each other; the batch file gives the result, then PowerShell reads it in like text and turns it into something useful. Sometimes getting that data can feel more like magic tricks than math—it's all about knowing what you're looking for. There are great ways to do this without needing a batch file at all. Also, check out this tool from The Dude by @nigelivey. It looks okay but I think it just lets you type commands and run scripts that can be done yourself easily. If you build your own script, you get more control and free tools if you change things later. Use Get-ComputerInfo to talk to computers on the network instead of relying on other software. The less tools you need is better. Now I'm curious: what are the top 5 items that a cheap IoT device dropped from the network or had to restart? So when something goes wrong, someone will get an email and stop the panic before it gets bad.