locked
How to know if port is available on remote machine. RRS feed

  • Question

  • Hi,

    I want to configure a service on remote machine which I am able to do by powershell scripts. Now one bit is left. Right now I am passing the port number where on which I want the service to run. Now I want the script to find the available port number may be in some given range like 1000 - 1999. I need help how to check which port is available in the given range. I have googled it and found "Test-NetConnection command but I am using powershell 5 and the comdlet is not available in this. Please help me to know the free port number on the remote machine using powershell.

    Thanks % Regards,

    Girish

    Monday, July 10, 2017 1:35 PM

Answers

  • There is no way to know if a port is being used remotely.  All ports that are not in use will be blocked by the firewall and many ports that are in use will appear to be unused except when the a program has them open.

    You need to work with your sysadmins to allocate an unused port.


    \_(ツ)_/

    • Marked as answer by Girish Nehte Tuesday, July 11, 2017 6:43 AM
    Monday, July 10, 2017 2:19 PM