I have a problem where I know I will be given an unpatched windows box lets say its a XP and a windows 7.

They will not be connected to the internet so I want to write a script that will use netsh to block all ports, but the ones I must have open example will be port 80 and RDP 3389 along with a dns so 53.

example I know the rules to allow out and in will look like this.

netsh advfirewall firewall> 
Add rule name="default rule" dir=out protocol=udp localport=5000-10000 action=block

netsh firewall> add portopening ALL 5000-10000 badports DISABLE

This will block all ports going out from 5000-10000 but I want to block all ports above X or I want to pass a list of ports I do want. a script that will take a small list I can edit and will add rules to block all out going BESIDES those three or four ports.

If more info is needed I will be happy to update my question.

link|improve this question
This should be moved to Server Fault because it is Windows administration related. – Bernie White Jan 20 at 21:52
feedback

migrated from security.stackexchange.com Jan 24 at 11:46

This question came from our site for IT security professionals.

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown

Browse other questions tagged or ask your own question.