Untitled
unknown
plain_text
3 months ago
1.5 kB
5
Indexable
function print($message) { Write-Host "" Write-Host $message } # Get Arguments #$rootFolder = $args[0] #$webAppName = $args[1] #$ipAddress = $args[2] #$frameworkVersion = $args[3] $rootFolder = "C:\inetpub\wwwroot" $webAppName = $args[0] $ipAddress = "*" $frameworkVersion = "v4.0" #$siteId = $args[4] # Create web app folders print "Creating web app folders" mkdir $rootFolder\$webAppName # Create IIS Websites and Application Pools and configure New-WebAppPool -Name $webAppName Set-ItemProperty IIS:\AppPools\$webAppName managedRuntimeVersion $frameworkVersion New-Website -Name $webAppName -PhysicalPath $rootFolder\$webAppName -ApplicationPool $webAppName #-Id $siteId #-HostHeader $webAppName #SSL Binding $certPath = 'Cert:\LocalMachine\My\a75f71c8e0a4422070f2a878e5c30c5799087991' New-WebBinding -name $webAppName -Protocol https -IPAddress $IPAddress -HostHeader $webAppName -SSLFlags 1 $certificate = Get-ChildItem Cert:\LocalMachine\My | Where-Object {$_.Thumbprint -eq "a75f71c8e0a4422070f2a878e5c30c5799087991"} New-Item -Path "IIS:\SslBindings\!443!$webAppName" -Value $certificate -SSLFlags 1 Get-WebBinding -Port 80 -Name $webAppName | Remove-WebBinding # Apply NTFS Permissions $appPoolIdentity = "IIS APPPOOL\" + $webAppName icacls $rootFolder\$webAppName /inheritance:d icacls $rootFolder\$webAppName /remove:g IIS_IUSRS icacls $rootFolder\$webAppName /grant $appPoolIdentity":(OI)(CI)"M icacls $rootFolder\$webAppName /grant IUSR":(OI)(CI)"M
Editor is loading...
Leave a Comment