SP2 firewall

R

Robbie Niblock

Is there any way of opening a range of ports on the XP sp2 firewall? e.g. if
I want to open up ports 15000 - 15200 (udp and tcp).

Also - can I do this using GPOs?

Thanks in advance.

Robbie
 
T

Torgeir Bakken \(MVP\)

Robbie said:
Is there any way of opening a range of ports on the XP sp2 firewall?
e.g. if I want to open up ports 15000 - 15200 (udp and tcp).
Hi,

Running netsh.exe in a script is an option.

The netsh.exe syntax is documented in WF_XPSP2.doc.

WF_XPSP2.doc "Deploying Windows Firewall Settings for Microsoft
Windows XP with Service Pack 2" is downloadable from
http://www.microsoft.com/downloads/details.aspx?familyid=4454e0e1-61fa-447a-bdcd-499f73a637d1


Example VBScript below, change name, scope, profile to
what fits you.

'--------------------8<----------------------
Set oShell = CreateObject("WScript.Shell")

iPortStart = InputBox("Enter the first port you want to open", _
"Open a range of ports")
iPortStop = InputBox("Enter the last port you want to open", _
"Open a range of ports")

For i = iPortStart To iPortStop
oShell.Run "netsh.exe firewall add portopening protocol=all port=" & i _
& " name=BLA" & i & " mode=enable scope=subnet profile=domain", 0, True
Next

MsgBox "Finished adding ports", _
vbInformation + vbSystemModal, "Adding FW ports"

'--------------------8<----------------------



WSH 5.6 documentation (local help file) can be downloaded from here
if you haven't got it already:
http://msdn.microsoft.com/downloads/list/webdev.asp
 
S

S.Sengupta

Run a script file, such as a batch file (*.BAT) or a command file
(*.CMD), that contains the series of Netsh commands to configure the
Windows Firewall operational mode, allowed programs, allowed ports, etc.
For more information about using Netsh to configure Windows Firewall.

Open Command Prompt window and type in:netsh firewall /?
which will diplay various options.

To use a BAT file and the NETSH FIREWALL command see the post of Doug
Knox MS-MVP here:'sp2 Firewall Port Range'
http://forum.iamnotageek.com/history/topic.php/656490-1.html
just change values accordingly:-

@Echo OFF
FOR /L %%I IN (15000,1,15200) DO NETSH FIREWALL ADD PORTOPENING TCP %%I
FTPPort%%I

Use the following command from the Run dialog:-

@Echo OFF
FOR /L %I IN (15000,1,15200) DO NETSH FIREWALL ADD PORTOPENING TCP %I
FTPPort%I

regards,
ssg MS-MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top