1

I have a IIS 8 server I'm trying to replicate.

Get-Website

under "Bindings" I have a certain website with the following binding:

net.tcp 6202:*

How can I set this binding using Powershell on the replica?

I tried this:

Set-ItemProperty IIS:\Sites\SITENAME -Name bindings -Value 'net.tcp 6202:*' -Force

But it appears to simply does not do anything.

JustAGuy
  • 5,151
  • 11
  • 41
  • 55

2 Answers2

1

Try the following, based on another SO answer

Set-ItemProperty IIS:\Sites\SITENAME -Name bindings -Value @{protocol="net.tcp"; bindingInformation="6202:*"} -Force
Community
  • 1
  • 1
Frode F.
  • 52,376
  • 9
  • 98
  • 114
  • Cool! I'd have never guessed it. Do you know how would I be able to tell such thing next time? – JustAGuy May 18 '14 at 21:03
  • I don't have IIS so I can test it, but if you try `(Get-ItemProperty IIS:\Sites\SITENAME -Name bindings).bindings.gettype()` then you it would probably say `hashtable` or `dictionary`, which is what we created with `@{ }` That's the way to store multiple key/value-pairs in an itemproperty. – Frode F. May 18 '14 at 21:30
0

I recommend this snippet

New-IISSiteBinding -Name 'Default Web Site' -BindingInformation "8082:*" -Protocol net.tcp
Adam Oberhausen
  • 341
  • 1
  • 2
  • 4