Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8773193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:13:55+00:00 2026-06-13T18:13:55+00:00

On Machine A I am running a port scanner. On Machine B I would

  • 0

On Machine A I am running a port scanner. On Machine B I would like to open and close ports in an organized fashion. I am hoping to do all of this via powershell.

I found THIS script to run on Machine B however when scanning the same port from Machine A it still says that it is closed.

Do any of you know how I can successfully open a port on Machine B

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T18:13:56+00:00Added an answer on June 13, 2026 at 6:13 pm

    Avoid COM if possible. You can use TcpListener to open a port:

    $Listener = [System.Net.Sockets.TcpListener]9999;
    $Listener.Start();
    #wait, try connect from another PC etc.
    $Listener.Stop();
    

    If you happen to miss a Stop command during debugging – just close and re-open the application from where you opened the socket – hanging port should be cleared. In my case it was PowerGUI script editor.

    Then use TcpClient to check it.

    (new-object Net.Sockets.TcpClient).Connect($host, $port)
    

    If you cannot connect, means the firewall is blocking it.

    EDIT: To print a message when connection is received, you should be able to use this code (based on this article from MSDN):

    #put this code in between Start and Stop calls.
    while($true) 
    {
        $client = $Listener.AcceptTcpClient();
        Write-Host "Connected!";
        $client.Close();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a virtual machine running Windows XP SP3 32-bit. On this machine I
I am developing some application in Linux .This Linux is a virtual machine running
This MySQL script installs multiple triggers. It works on one machine running MySQL 5.0.51b-community.
I have a Django applciation running on Apache with mod_wsgi, but I would like
I run a bash shell on machine A running via ssh a perl shell
I have 2 applications running on the same machine: node.js app running on port
I have jboss running on my machine on port 8080, i wanted to share
On a machine, there is a HTTP server running at a particular port. I
I have a virtual machine running windows xp inside a vmware instance. How do
I have a virtual machine running windows 2003 server. It is on a separate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.