Tag Archives: SharePoint 2019

SPWebApplication Class

NamespaceMicrosoft.SharePoint.Administration
AssemblyMicrosoft.SharePoint.dll

A SharePoint Server web application is composed of an Internet Information Services (IIS) web site that acts as a logical unit for the site collections that you create. Before you can create a site collection, you must first create a Web application. Each web application is represented by a different IIS web site with a unique or shared application pool. You can assign each web application a unique domain name. This helps prevent cross-site scripting attacks. When you create a new web application, you also create a new content database and define the authentication method used to connect to the database. In addition, you define an authentication method to be used by the IIS Web site in SharePoint Server.

Microsoft Documentation

SPWebApplication Class

ConstructorsFieldsPropertiesMethods

Working with the SPWebApplication class in PowerShell

The following example will return a collection [System.Array] of all web applications (instances of SPWebApplication class).

$oWebApps = Get-SPWebApplication

The following example will return a collection [System.Array] of all web applications (instances of SPWebApplication class) excluding those with a url that begins with “https”//mysite.contoso.com”.

$oWebApps = Get-SPWebApplication | where {!$_.Url.StartsWith("https://mysite.contoso.com")}