Quantcast
Channel: SharePoint 2013 - Setup, Upgrade, Administration and Operations forum
Viewing all articles
Browse latest Browse all 21070

How to open windows firewall ports with powershell

$
0
0

Hi

Ive got a code to open a Windows Firewall port for my Office Web App Server: 

#==============================================================
# Creates a rule to open an incomming port in the firewall.
#==============================================================

$port = New-Object -ComObject HNetCfg.FWOpenPort

$port.Port = 9999                  #type in the port to open
$port.Name = 'MyTestPort'     # name of Port



$port.Enabled = $true

$fwMgr = New-Object -ComObject HNetCfg.FwMgr

$profiledomain=$fwMgr.LocalPolicy.GetProfileByType(0)

$profiledomain.GloballyOpenPorts.Add($port)

#==============================================================

I have been trying to change it to add multiple ports, but i cant get it to work.

Any ideas?

br

Bjørn


Viewing all articles
Browse latest Browse all 21070

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>