Few days back I was asked to create a script, which will check RDP port status of multiple servers and send the result as an email notification. I have searched for few, but unfortunately there was no ready script for that. I decided to build one using PowerShell, and came out with following script.
Hope this script might help you as well.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
#Which port to scan $port = 3389 #Path of the input server list $hostns=Get-Content D:Servers.txt $body = @() foreach ($hostn in $hostns) { $PortCon = new-object System.Net.Sockets.TcpClient($hostn, $port) if ($PortCon.Connected -eq 'True') { $body +="$hostn Server listening to port $port" $PortCon.Close() } else { $body +="$hostn Server not responding to $port" } } $body = $body | Out-String $NotiEmail = @{ Subject = "Server Status Check" SMTPServer = "YOUR SMTP SERVER" Priority = "High" Body = $body } Send-MailMessage @NotiEmail |
Microsoft Active Directory Domain Services Vulnerability (CVE-2026-25177) — What Administrators Need to Know
In early March 2026, Microsoft released an important security update addressing a…
Windows Users Beware: SnappyClient — The Compact Implant That Hijacks Crypto and Disables Defenses
A compact but capable Windows implant called SnappyClient has emerged as a…
Hotpatch Alert: Microsoft Fixes Critical RRAS Remote-Execution Flaws in Windows 11
Microsoft issued an out-of-band hotpatch on March 13, 2026, to address a…
Zero-Day on the Market: $220K Exploit Targets Windows Remote Desktop Services (CVE-2026-21533)
Remote Desktop Services (RDS) has come under renewed scrutiny after reports that…