Home > Articles

  • Print
  • + Share This
This chapter is from the book

Create a New Web Application

Solution: Use the New-SPWebApplication cmdlet from the SharePoint 2010 Management Shell.

You may now use the SharePoint 2010 Management Shell because SharePoint has been installed and the SPModule commands have been utilized. If you are running a full script and/or still wish to use the PowerShell console, be sure to add the SharePoint snap-in (Add-PsSnapin Microsoft.SharePoint.PowerShell) such that the SharePoint cmdlets are available.

To add a new web application, use the New-SPWebApplication cmdlet as follows:

New-SPWebApplication –applicationpool <name of new application pool>
-name <name of new web app>
-applicationpoolaccount <service account to be used for the
application pool> -port <desired port number>

A sample command-line entry for creating the main SharePoint web application is shown in Listing 3.5.

Listing 3.5. Creating a New Web Application

New-SPWebApplication –applicationpool SharePoint-80
-name SharePoint-80 -applicationpoolaccount SP\AppPoolAccount -port 80

This process may take a few minutes. When it's completed, the display name and the URL of the new web application are presented in the console.

  • + Share This
  • 🔖 Save To Your Account