Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

WebAdministration: site creation failing in Server 2012, works in Server 2008/Windows 7

$
0
0

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?




Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>