Created
April 28, 2015 17:19
-
-
Save nedward/d181c84cf6d90c16a876 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
powershell_script "new website for #{site_name}" do | |
code <<-EOH | |
Import-Module WebAdministration | |
if (-not(test-path IIS:\\Sites\\#{site_name})){ | |
$NewWebsiteParams = @{Name= '#{site_name}';Port= #{site_data["port"]};PhysicalPath= '#{site_dir}';ApplicationPool= '#{site_name}'} | |
New-Website @NewWebsiteParams | |
} | |
elseif ((Get-WebBinding -Name #{site_name}).bindingInformation -ne '*:#{site_data["port"]}:') { | |
$CurrentBinding = (Get-WebBinding -Name #{site_name}).bindingInformation | |
$BindingParameters = @{Name= '#{site_name}';Binding= $CurrentBinding;PropertyName= 'Port';Value = #{site_data["port"]} } | |
Set-WebBinding @BindingParameters | |
} | |
Get-Website -Name #{site_name} | Where {$_.state -like 'Stopped'} | Start-Website | |
EOH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment