We have the following script block that we've been using for a while (on Windows Server 2008 and Windows 7) to create sites in IIS:
Import-Module WebAdministration Set-Location IIS:/ Get-ChildItem Sites $bindings = @{protocol="http";bindingInformation="*:8282:"},@{protocol="net.tcp";bindingInformation="4343:*"},@{protocol="net.pipe";bindingInformation="*"} $site = New-Item Sites\site -bindings $bindings
The Get-ChildItem call lists the existing sites correctly. "site" does not yet exist.
When we run it on Windows Server 2012, we get:
New-Item : Length cannot be less than zero. Parameter name: length At C:\Users\Administrator\test.ps1:5 char:9+ $site = New-Item Sites\site -bindings $bindings+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : InvalidArgument: (:) [New-Item], ArgumentOutOfRangeException+ FullyQualifiedErrorId : Length cannot be less than zero. Parameter name: length,Microsoft.PowerShell.Commands.NewItemCommand
Any ideas?