Skip to content

Instantly share code, notes, and snippets.

@mikerodionov
Last active July 15, 2020 12:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikerodionov/7d23e524954f8777904e61b91f9f6206 to your computer and use it in GitHub Desktop.
Save mikerodionov/7d23e524954f8777904e61b91f9f6206 to your computer and use it in GitHub Desktop.
#Set Execution Policy if necessary using command below
#Set-ExecutionPolicy Unrestricted -Force
#--------------------------------
#Modules
#
Import-Module WebAdministration
#--------------------------------
#Variables
#
$DrivePath = "C:\inetpub\K2"
# K2 workspace site settings
$K2WebAppPoolName = "K2"
$K2WebSiteName = "K2"
$K2WebHostHeader = ":443:K2.denallix.com"
#--------------------------------
#Script
#
#Create directory for IIS web site
New-Item -type directory -path $DrivePath
#K2 Web site settings
#Create application pool, K2 installer will set the service account
New-Item IIS:\AppPools\$K2WebAppPoolName
Set-ItemProperty IIS:\AppPools\$K2WebAppPoolName 'managedPipelineMode' "Classic"
#Create IIS site, set the binding, enable windows auth and disable anon
New-Item IIS:\Sites\$K2WebSiteName -bindings @{protocol='http';bindingInformation=$K2WebHostHeader} -PhysicalPath $DrivePath
Set-ItemProperty IIS:\Sites\$K2WebSiteName -name applicationPool -value $K2WebSiteName
Set-WebConfigurationProperty -filter /system.WebServer/security/authentication/AnonymousAuthentication -name enabled -value false -location $K2WebSiteName
Set-WebConfigurationProperty -filter /system.WebServer/security/authentication/WindowsAuthentication -name enabled -value true -location $K2WebSiteName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment