none
how to create Wepapplication

    Question

  • good morning all,

     how to create a webapplication using powershell and how to add sitecontent and subsites in it

    please help me.

    regards,

    Thillairaja

    Tuesday, April 18, 2017 4:01 AM

All replies

  • # Replace:
    #   DATABASE
    #   NAMED
    #   APPLICATION NAME
    #   hostheadername
    #   DOMAIN\USER
    #   DOMAIN\SP_FARM_ACCOUNT
    #   PATHNAME
    #   SITE COLLECTION NAME
    #   DIRECTORYPORT
    
    # Create Authentication Provider
    $ap = New-SPAuthenticationProvider
    
    # Create Web Application
    $w = New-SPWebApplication -DatabaseName "WSS_Content_DATABASE" -ApplicationPool "NAMED App Pool" -Name "APPLICATION NAME" -Port 80 -AuthenticationProvider $ap1 -ApplicationPoolAccount (Get-SPManagedAccount 'DOMAIN\SP_FARM_ACCOUNT') -Path "%wwwroot%\wss\VirtualDirectories\DIRECTORYPORT" -HostHeader "hostheadername"
    iisreset /noforce
    
    # Create Root Site Collection
    $w = Get-SPWebApplication "APPLICATION NAME"
    New-SPSite http://sub.domain.com -OwnerAlias "DOMAIN\USER" -HostHeaderWebApplication $w -Name "APPLICATION NAME" -Template "BLANKINTERNETCONTAINER#0"
    
    # Create Managed Path Site Collection
    New-SPManagedPath "PATHNAME" -HostHeader -Explicit
    New-SPSite http://sub.domain.com/PATHNAME -OwnerAlias "DOMAIN\USER" -HostHeaderWebApplication $w -Name "SITE COLLECTION NAME" -Template "BLANKINTERNETCONTAINER#0"
    Tuesday, April 18, 2017 11:13 AM
  • Hi Thillairaja,

    Is there any update?

    If the post helps you, you can mark it as answer.

    Best regards,

    Grace Wang


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Thursday, May 4, 2017 12:16 PM