Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Netsh delete all urlacl reservations of a specific port

is there any way to delete every urlacl reservation of a specific port.

I mean something like this is possible (customer constelation):

netsh http add urlacl url=http://localhost:55521/ user="everyone"

netsh http add urlacl url=http://+:55521/ user="everyone"

Now I would like to delete every reservation of port 55521, this could be any ip constelation!

By the way I am doing this in a c# application with a nancy self host.

like image 413
Franki1986 Avatar asked Jan 01 '23 14:01

Franki1986


2 Answers

to show the urls:

netsh http show urlacl

to delete a url:

netsh http delete urlacl url=http://localhost:55521/
like image 169
0x53olution Avatar answered Jan 26 '23 01:01

0x53olution


Adding to the solution from 0x53olution, an easy way to get all acls in a list is running PowerShell:

netsh http show urlacl | Select-String -Pattern "55521"

I copied the output to a temporary file and deleted the Reserved URL : part, then you can do:

Get-Content <temp-file>.txt | % {netsh http delete urlacl url=$_}

The saving to a temporary file part could be skipped with some -replace action.

If you want to find more rules, you can use for example Select-String -Pattern "55521|55522|55523" instead.

like image 28
AmazingRealist Avatar answered Jan 25 '23 23:01

AmazingRealist