CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2010
    Posts
    22

    Using INetFwOpenPorts ports to open FireWall Ports

    Hello,

    I was hopeing for some assistance with my topic. I am attempting to develop a Console Application using C# that will open

    around 13 Ports on Multiple Windows 2008 Servers. I came across this link http://blogs.msdn.com/b/securitytool...gs-with-c.aspx on MSDN which helps describe the process.

    Was wondering if anyone had any more examples or sample code I could view.

    I see I need to:

    INetFwOpenPort port;

    Port.port = "PortNumber";

    Port.Name = "PortName";

    Port.enabled = True;

    // Then add the GloballyOpen Ports Collection

    ports.Add(port);

    Now since I have 13 ports that needs to be opened, was wondering what the best method of coding this port names and Numbers would be? Possible place the names and numbers in an array and call THEN add them using a Loop.

    Again, any insight would be helpful.

    Thank You!

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Using INetFwOpenPorts ports to open FireWall Ports

    Powershell could be used to do that, pretty easily.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Aug 2010
    Posts
    22

    Re: Using INetFwOpenPorts ports to open FireWall Ports

    Really. So you think it would be more efficient going the scripting route.

    Yeah I have not used PowerShell yet, only VBScripting.

    So this is why I chose to go the C# Console route.

    If you have any examples, I would be happy to check them out.

    Thank You.

  4. #4
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Using INetFwOpenPorts ports to open FireWall Ports

    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured