Skip to content

Instantly share code, notes, and snippets.

@george-polevoy
Created May 31, 2016 13:57
Show Gist options
  • Save george-polevoy/5d7f109560762f9ac42eb7a7a6783789 to your computer and use it in GitHub Desktop.
Save george-polevoy/5d7f109560762f9ac42eb7a7a6783789 to your computer and use it in GitHub Desktop.
Parses XML file with urls and sets acl for http bindings. Useful for Visual Studio to debug without admin permissions.
param (
[string]$user
)
# USAGE: & '.\set-url-acl.ps1' -user domain\user
$xmlPath = 'Settings\SomeSettings.xml'
[xml]$xml = Get-Content $xmlPath
$nodes = Select-Xml "//Services/HttpDispatcher" $xml
$nodes | ForEach-Object {
Write-Host "http:/*:$($_.Node.ListenAddress)"
& netsh http add urlacl url="http://*:$($_.Node.ListenAddress)" user="$($user)"
#& netsh http delete urlacl url="http://localhost:$($_.Node.ListenAddress)"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment