Merge pull request #1071 from nlandais/devel
Adding fix to get around bug found with the New-Website command when…
This commit is contained in:
commit
a155f7ee34
1 changed files with 6 additions and 0 deletions
|
@ -102,6 +102,12 @@ Try {
|
||||||
If ($bind_hostname) {
|
If ($bind_hostname) {
|
||||||
$site_parameters.HostHeader = $bind_hostname
|
$site_parameters.HostHeader = $bind_hostname
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Fix for error "New-Item : Index was outside the bounds of the array."
|
||||||
|
# This is a bug in the New-WebSite commandlet. Apparently there must be at least one site configured in IIS otherwise New-WebSite crashes.
|
||||||
|
# For more details, see http://stackoverflow.com/questions/3573889/ps-c-new-website-blah-throws-index-was-outside-the-bounds-of-the-array
|
||||||
|
$sites_list = get-childitem -Path IIS:\sites
|
||||||
|
if ($sites_list -eq $null) { $site_parameters.ID = 1 }
|
||||||
|
|
||||||
$site = New-Website @site_parameters -Force
|
$site = New-Website @site_parameters -Force
|
||||||
$result.changed = $true
|
$result.changed = $true
|
||||||
|
|
Loading…
Reference in a new issue