Check if specific port is open via script?

adevezin
Giga Contributor

Is there a way to check if a port is open via a script? I just want to check if a custom port i have on my network is open via a workflow script.

1 ACCEPTED SOLUTION

Antony_Alldis
ServiceNow Employee
ServiceNow Employee
5 REPLIES 5

sachin_namjoshi
Kilo Patron
Kilo Patron

Port scanning is the first step in the Discovery process. In this stage, Discovery scans the configured IP addresses for TCP and UDP IP ports to determine what ports are open or responsive. When scanning IP Ranges, Discovery searches for responses from WMI, SSH and SNMP protocols. Port scanning results are found in the input package of the Shazzam probe in the ECC Queue



Discovery Troubleshooting - Port Scanning - ServiceNow Wiki



Regards,


Sachin


Marlos
ServiceNow Employee
ServiceNow Employee

Hi Adrian,



You could use a powershell workflow activity and use the port scanner script below for example:



Script Test-Port


adevezin
Giga Contributor

Thank you this is exactly what i was looking for


Antony_Alldis
ServiceNow Employee
ServiceNow Employee

I wrote 2 x KB Articles some time ago that you might find useful:



Port Scan Natively Using Powershell


Port Scan Natively Using Bash on Linux