APPCMD how to test if binding exists before I add it to a website?
Asked Answered
M

1

6

We use appcmd in our deployment scripts to setup servers , I need to ensure that adding bindings to existing sites doesn't throw an error

C:\Windows\System32\inetsrv\appcmd.exe set site /site.name:"abc.com" 
/+bindings.    [protocol='http',bindingInformation='*:80:alias-abc.com']

works but in the next script run I get the error ..

cannot add duplicate collection entry of type 'binding' with combined key attribuites 'protocol, bindingInformation' respectively set to ' http, *:alias-abc.com'

Is there a way I can check if the binding exists before adding it in appcmd

(powershell is not allowed - so has to be either appcmd or other command line exe)

Thanks

Mileage answered 17/10, 2014 at 3:50 Comment(0)
I
1

appcmd is a bit lacking in the search department, but something like this should work:

C:\Windows\system32\inetsrv\appcmd.exe list site "abc.com" | findstr bindings:http/*:80
Imelda answered 30/11, 2016 at 4:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.