Skip to content

asheroto/IsPortActive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Release Date - Published_At GitHub Downloads - All Releases GitHub Sponsor ko-fi

IsPortActive

This script checks if a port is currently active or in use. It can check for active TCP and UDP connections on a specified port, by process name, or by process ID.

If the process name is svchost, the script will find the service and display name in addition to the process name.

Requirements

  • PowerShell 7+

Installing

You can either download the PS1 script from here, or install using...

Install-Script IsPortActive -Force

Answer Yes to any prompts. -Force is optional, but it will force the script to update if it is outdated.

This script is published on PowerShell Gallery.

Usage

IsPortActive [-Port <int>] [-ProcessName <string>] [-ProcessId <int>] [-Version] [-Help] [-CheckForUpdate]

Parameters

Only one of the following parameters can be used at a time.

Parameter Description
-Port Specifies the port number to check for active connections.
-ProcessName Specifies the name of the process to check for active connections.
-ProcessId Specifies the process ID to check for active connections.
-Version Displays the version of the script.
-Help Displays the help information for the script.
-CheckForUpdate Checks for updates of the script.

Examples

Description Command
Check if port 443 is active IsPortActive -Port 443
Check what ports are being used by process httpd IsPortActive -ProcessName "httpd"
Check what ports are being used by process ID 1234 IsPortActive -ProcessId 1234

Screenshots

Check Port

image

Check Process Name

image

Check Process ID

image