Create a New Web Application

Scenario/Problem: You need to create a new web application for the SharePoint farm.

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

You can now use the SharePoint 2013 Management Shell because SharePoint has been installed and the SPModule commands have been utilized. If you are running a full script and/or still want to use the PowerShell console, be sure to add the SharePoint snap-in (Add-PsSnapin Microsoft.SharePoint.PowerShell) so 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 ...

Get PowerShell™ for SharePoint® 2013 How-To now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.