Created
October 3, 2014 10:35
-
-
Save Atalanta/a994574adbd4b8e37677 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment