Can I add range of ports in netsh add urlacl?
Asked Answered
B

1

16

I use the following command to allow listening of specific HTTP ports:

netsh http add urlacl url=http://+:[port]/ user=DOMAIN\UserName

But if I need to open a range of ports, can I setup a single rule?

Bari answered 17/7, 2014 at 12:8 Comment(4)
Has anyone found a solution for this? Been researching it for a while and can't find a decent solution. Answer below is useless if you have a large range of ports.Underpants
did you ever solve this issue?Underpants
Unfortunately, no.Bari
Having a range would go against the reason for having the urlacl system in the first place: to force apps to bind to the most minimal portion of the namespace possible, without interfering with other apps.Puzzle
F
12

I didn't find any way to specify a range so I went with using built-in FOR command:

for /L %i in ([port_start],1,[port_end]) do netsh http add urlacl url=http://+:%i/ user=DOMAIN\UserName

You can get more info on the FOR command by using 'FOR /?' in command prompt. /L happened to be the one that worked for me because it builds a set of numbers given start, stop and step values.

Format answered 20/11, 2014 at 18:30 Comment(1)
Not sure why this was downvoted but it worked perfectly for me... for /L %i in (32000,1,32099) do netsh http add urlacl url=http://+:%i/ user="NT AUTHORITY\NETWORK SERVICE"Preengage

© 2022 - 2024 — McMap. All rights reserved.