Submit a ticketCall us

AnnouncementsAre You “Flying Blind?”

When it comes to your complex IT infrastructure, you want to ensure you have a good grasp of what’s going on to avoid any fire drills that result from guesswork. Read our white paper to learn how proactively monitoring your IT environment can help your organization while giving you peace of mind.

Get your free white paper.

Home > Success Center > Orion Platform > Orion - Knowledgebase Articles > Use PowerShell to test that a port is open on a server

Use PowerShell to test that a port is open on a server

Table of contents

Updated: 03/12/2018

Overview

How to test that a specific ports is open without using telnet.

Environment

  • All modules
  • All Windows Server versions

Steps

1. Use the script bellow to check if the port is open.

2. Replace IP_Address_Server with the address of the server you are interested in.

3. Replace port with the port to check (e.g. 17777).

4. Save this script in a text file as porttest.ps1 and run in PowerShell.

$ipaddress = IP_Address_Server
$port = port
$connection = New-Object System.Net.Sockets.TcpClient($ipaddress, $port)
if ($connection.Connected) {
    Write-Host "Success"
}
else {
    Write-Host "Failed"
}

 

Last modified

Tags

Classifications

Public