title: Changing IIS bindings with PowerShell
body: <p>I was looking to move web binding port from one site to another using PowerShell on Windows&nbsp;21012&nbsp;R2.</p>
  
  <p>After looking online I found the command</p>
  
  <pre><code>Set-WebBinding -Name 'work' -BindingInformation "*:80:" -PropertyName Port -Value 1234
  </code></pre>
  
  <p>Now the command is from a MS blog but everytime I run the command I get the following error.</p>
  
  <blockquote>
    <p>WARNING: Target configuration object '/system.applicationHost/sites/site[compare-string-ordinal(@name,'work',true())=0]/bindings/binding[(@protocol='http' or @protocol='https') and compare-string-ordinal(@bindingInformation,'*:80:',true())=0] is not found at path 'MACHINE/WEBROOT/APPHOST'</p>
  </blockquote>
  
  <p>Now for the life of me cannot understand why it's not finding the site "work":</p>
  
  <pre>
  PS C:\Windows\system32> Get-WebBinding -Port 80 -Name "work"
  
  protocol        bindingInformation        sslFlags
  --------        ------------------        --------
  http            :80:work                         0
  </pre>
  
  <p>These are clean sites created by PowerShell that also creates an application pool of the same name.</p>