Create a Web application through PowerShell

Hello friends, in this article I'll tell you how to create a web application in SharePoint 2013 through PowerShell script.

Demo: Now I am going to create a web application with port 5566:

Steps:

First please open "SharePoint 2013 Management Shell

  1. use help command followed by command name for more information --> "help New-SPWebApplication" 
  2. create an authentication provider for use further in creation of web application
  3. $ap = New-SPAuthenticationProvider -UseWindowsIntegratedAuthentication -DisableKerberos
  4. use follwoing script for create a web application

PS C:\Users\myUsername> New-SPWebApplication -Name "Fresher site - 5566" -Port 5566 -URL "http://dsknomoe12:5566/" -ApplicationPool "SharePoint - 80" -ApplicationPoolAccount (Get-SPManagedAccount "myPC\myUsername") -AuthenticationProvider $ap

Another way:

PS C:\Users\myUsername> New-SPWebApplication -Name "Fresher site" -Port 5566 -URL "http://dsknomoe12" -ApplicationPoolAccount (Get-SPManagedAccount "myPC\myUsername") -AuthenticationProvider $ap

cmdlet New-SPWebApplication at command pipeline position 1

Supply values for the following parameters:

ApplicationPool: FresherAppPool

WOW, WebApplication created successfully….

Add comment