Overview

Now that we have provisioned SharePoint and added our host ‘A’ record with PowerShell, it is time to move on to creating the Web application. Prior to creating a SharePoint site collection, you must have a web application in Internet Information Services (IIS). A web application has a content database and application pool associated with it and is assigned to one of five zones: Default, Intranet, Internet, Custom, and Extranet.

You can assign a Web application to a host ‘A’ record or use your machine name. If you plan on having more than one Web application on the same URL, you must use a different port number for the web application. In a standard web application, the port number is 80 by default. In this example, we will create a new Web application using ‘lab.ps4sp.com’ on port 80. We will also use Classic Mode Authentication for the time being. We will change this as we get the farm up and running.

There are a number of advance configuration options here that will allow us to set up authentication and additional claims providers. We will take a look at these when we build a claims-aware web application.

Figure 1

 

The Cmdlets

 

New-SPWebApplication

This cmdlet creates a new Web application specified by the Name parameter. The user specified by the DatabaseCredentials parameter must be a member of the dbcreator fixed server role on the database server.

New-SPWebApplication -ApplicationPool <String> -Name <String> [-AdditionalClaimProvider <SPClaimProviderPipeBind[]>] [-AllowAnonymousAccess <SwitchParameter>] [-ApplicationPoolAccount <SPProcessAccountPipeBind>] [-AssignmentCollection <SPAssignmentCollection>] [-AuthenticationMethod <String>] [-AuthenticationProvider <SPAuthenticationProviderPipeBind[]>] [-Confirm [<SwitchParameter>]] [-DatabaseCredentials <PSCredential>] [-DatabaseName <String>] [-DatabaseServer <String>] [-HostHeader <String>] [-Path <String>] [-Port <UInt32>] [-SecureSocketsLayer <SwitchParameter>] [-ServiceApplicationProxyGroup <SPServiceApplicationProxyGroupPipeBind>] [-SignInRedirectProvider <SPTrustedIdentityTokenIssuerPipeBind>] [-SignInRedirectURL <String>] [-Url <String>] [-WhatIf [<SwitchParameter> ]] [<CommonParameters>]

The Script

 

$siteName = “PowerShell for SharePoint”

$port = 80

$hostHeader = “lab.ps4sp.com”

$url = http://lab.ps4sp.com&#8221;

$appPoolName = “PS4SPAppPool”

$managedAccount = “PS4SPspservice”

$dbServer = “PS-SQL”

$dbName = “PS4SP_SP2010_LAB_ContentDB”

$allowAnonymous = $true

$authenticationMethod = “NTLM”

$ssl = $false

New-SPWebApplication -Name $siteName -Port $port -HostHeader $hostHeader -URL $url -ApplicationPool $appPoolName -ApplicationPoolAccount (Get-SPManagedAccount “$managedAccount”) -DatabaseName $dbName -DatabaseServer $dbServer -AllowAnonymousAccess: $allowAnonymous -AuthenticationMethod $authenticationMethod -SecureSocketsLayer:$ssl

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s