I was looking to move web binding port from one site to another using PowerShell on Windows 21012 R2.
After looking online I found the command
Set-WebBinding -Name 'work' -BindingInformation "*:80:" -PropertyName Port -Value 1234
Now the command is from a MS blog but everytime I run the command I get the following error.
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'
Now for the life of me cannot understand why it's not finding the site "work":
PS C:\Windows\system32> Get-WebBinding -Port 80 -Name "work" protocol bindingInformation sslFlags -------- ------------------ -------- http :80:work 0
These are clean sites created by PowerShell that also creates an application pool of the same name.