IIS with ASP.NET support check

IIS with ASP.NET support check

I have in the past had an occasion to check if IIS is installed with support for ASP.NET applications. This function will do all you need: function

Send Mail with PowerShell
Open Port Scanning
Check Active Directory for Stale Computers

I have in the past had an occasion to check if IIS is installed with support for ASP.NET applications. This function will do all you need:

function IIS_Check {
# IIS
if ((Get-WindowsFeature Web-Server).InstallState -eq "Installed") {
Write-Host "IIS is installed - Meets MD-STAFF Requirements"
}
else {
Write-Host "IIS is not installed - DOES NOT Meet MD-STAFF Requirements"
write-host "Installing IIS and features need to run MD-STAFF Application"
# Install IIS and features needed to run ASP.NET applications
Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebServerRole
Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebServer
Enable-WindowsOptionalFeature -Online -FeatureName IIS-CommonHttpFeatures
Enable-WindowsOptionalFeature -Online -FeatureName IIS-HttpErrors
Enable-WindowsOptionalFeature -Online -FeatureName IIS-HttpRedirect
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ApplicationDevelopment
Enable-WindowsOptionalFeature -Online -FeatureName IIS-NetFxExtensibility45
Enable-WindowsOptionalFeature -Online -FeatureName IIS-HealthAndDiagnostics
Enable-WindowsOptionalFeature -Online -FeatureName IIS-HttpLogging
Enable-WindowsOptionalFeature -Online -FeatureName IIS-LoggingLibraries
Enable-WindowsOptionalFeature -Online -FeatureName IIS-RequestMonitor
Enable-WindowsOptionalFeature -Online -FeatureName IIS-HttpTracing
Enable-WindowsOptionalFeature -Online -FeatureName IIS-Security
Enable-WindowsOptionalFeature -Online -FeatureName IIS-RequestFiltering
Enable-WindowsOptionalFeature -Online -FeatureName IIS-Performance
Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebServerManagementTools
Enable-WindowsOptionalFeature -Online -FeatureName IIS-IIS6ManagementCompatibility
Enable-WindowsOptionalFeature -Online -FeatureName IIS-Metabase
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ManagementConsole
Enable-WindowsOptionalFeature -Online -FeatureName IIS-BasicAuthentication
Enable-WindowsOptionalFeature -Online -FeatureName IIS-WindowsAuthentication
Enable-WindowsOptionalFeature -Online -FeatureName IIS-StaticContent
Enable-WindowsOptionalFeature -Online -FeatureName IIS-DefaultDocument
Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebSockets
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ApplicationInit
Enable-WindowsOptionalFeature -Online -FeatureName IIS-NetFxExtensibility45
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ASPNET45
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ISAPIExtensions
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ISAPIFilter
Enable-WindowsOptionalFeature -Online -FeatureName IIS-HttpCompressionStatic
write-host "Completed installing IIS and ASP.NET features"
}
}

Once IIS is installed you can better configure IIS using the WebAdministration module for PowerShell

Import-Module WebAdministration 

Now you can create a new WebSite and Application Pool.
Create an Application Pool:

New-WebAppPool -name "MyWebSiteAppPool"  -force
$appPool = Get-Item -name "MyWebSiteAppPool" 
$appPool.processModel.identityType = "NetworkService"
$appPool.enable32BitAppOnWin64 = 1
$appPool | Set-Item

Create a Web Site:

md "c:\Web Sites\MyWebSite"
# All on one line
$site = $site = new-WebSite -name "MyWebSite" 
                            -PhysicalPath "c:\Web Sites\MyWebSite" 
                            -HostHeader "home.thecodeasylum.com"
                            -ApplicationPool "MyWebSiteAppPool" 
                            -force

COMMENTS

WORDPRESS: 0