Set-SPWebApplication

Configures the specified web application.

Syntax

Set-SPWebApplication
   [-Identity] <SPWebApplicationPipeBind>
   [-DefaultTimeZone <Int32>]
   [-DefaultQuotaTemplate <String>]
   [-ServiceApplicationProxyGroup <SPServiceApplicationProxyGroupPipeBind>]
   [-NotProvisionGlobally]
   [-AssignmentCollection <SPAssignmentCollection>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-SPWebApplication
   [-Identity] <SPWebApplicationPipeBind>
   -Zone <SPUrlZone>
   [-AuthenticationProvider <SPAuthenticationProviderPipeBind[]>]
   [-AdditionalClaimProvider <SPClaimProviderPipeBind[]>]
   [-SignInRedirectURL <String>]
   [-SignInRedirectProvider <SPTrustedIdentityTokenIssuerPipeBind>]
   [-AuthenticationMethod <String>]
   [-Force]
   [-NotProvisionGlobally]
   [-AssignmentCollection <SPAssignmentCollection>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-SPWebApplication
   [-Identity] <SPWebApplicationPipeBind>
   -Zone <SPUrlZone>
   [-SecureSocketsLayer]
   [-HostHeader <String>]
   [-Certificate <SPServerCertificatePipeBind>]
   [-UseServerNameIndication]
   [-AllowLegacyEncryption]
   -Port <Int32>
   [-Url <String>]
   [-NotProvisionGlobally]
   [-AssignmentCollection <SPAssignmentCollection>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-SPWebApplication
   [-Identity] <SPWebApplicationPipeBind>
   -SMTPServer <String>
   [-SMTPServerPort <Int32>]
   [-OutgoingEmailAddress <String>]
   [-ReplyToEmailAddress <String>]
   [-SMTPCredentials <PSCredential>]
   [-DisableSMTPEncryption]
   [-Certificate <SPServerCertificatePipeBind>]
   [-NotProvisionGlobally]
   [-AssignmentCollection <SPAssignmentCollection>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

This cmdlet contains more than one parameter set. You may only use parameters from one parameter set, and you may not combine parameters from different parameter sets. For more information about how to use parameter sets, see Cmdlet parameter sets.

The Set-SPWebApplication cmdlet configures the web application specified by the Identity parameter. For any settings that are zone-specific (for the Zone parameter set), the zone to configure must be provided. The provided zone must already exist.

All IIS binding settings should be respecified when updating the binding of an IIS website via the Set-SPWebApplication cmdlet. This includes the URL, secure sockets layer setting, the port number, the host header, and the certificate. If a binding setting isn't respecified, it will revert to its default value.

For permissions and the most current information about Windows PowerShell for SharePoint Products, see the online documentation at SharePoint Server Cmdlets.

Examples

EXAMPLE 1

$credentials = Get-Credential
Set-SPWebApplication -Identity http://servername -SMTPServer mail.example.com -SMTPServerPort 587 -OutgoingEmailAddress user@example.com -ReplyToAddress replyto@example.com -SMTPCredentials $credentials

This example sets the http://servername web application to use the SMTP server mail.example.com, the SMTP server port 587, the from address user@example.com, the reply-to address replyto@example.com, and the credentials stored in the $credentials object.

EXAMPLE 2

Set-SPWebApplication -Identity http://servername -SMTPServer mail.example.com -OutgoingEmailAddress user@example.com -ReplyToAddress replyto@example.com -SMTPCredentials $null

This example sets the http://servername web application to use the SMTP server mail.example.com, the default SMTP server port, the from address user@example.com, the reply-to address replyto@example.com, and to connect to the SMTP server anonymously.

Parameters

-AdditionalClaimProvider

Adds a specific claim provider to the defined web application.

Type:SPClaimProviderPipeBind[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-AllowLegacyEncryption

Specifies that older SSL and TLS protocol versions and cipher suites are allowed to be used with this IIS website. Legacy encryption is weaker than modern encryption and is not recommended.

This feature requires Windows Server 2022 or higher. This feature is not available when SharePoint is deployed with earlier versions of Windows Server.

This parameter is only valid when used with the SecureSocketsLayer parameter.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-AssignmentCollection

Manages objects for the purpose of proper disposal. Use of objects, such as SPWeb or SPSite, can use large amounts of memory and use of these objects in Windows PowerShell scripts requires proper memory management. Using the SPAssignment object, you can assign objects to a variable and dispose of the objects after they are needed to free up memory. When SPWeb, SPSite, or SPSiteAdministration objects are used, the objects are automatically disposed of if an assignment collection or the Global parameter is not used.

When the Global parameter is used, all objects are contained in the global store. If objects are not immediately used, or disposed of by using the Stop-SPAssignment command, an out-of-memory scenario can occur.

Type:SPAssignmentCollection
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-AuthenticationMethod

Use to set a web application to classic Windows authentication. The valid values are NTLM or Kerberos.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-AuthenticationProvider

Defines the authentication provider(s) that applies to the web application.

Type:SPAuthenticationProviderPipeBind[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-Certificate

Specifies the certificate that will be used for the Secure Sockets Layer (SSL) binding of this IIS website, or for authenticating to an SMTP server to send email.

When configuring the Secure Sockets Layer (SSL) binding of this IIS website, this parameter is only valid when used with the SecureSocketsLayer parameter. When configuring SMTP authentication, this parameter is only valid when the DisableSMTPEncryption parameter is not specified.

Type:SPServerCertificatePipeBind
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-Confirm

Prompts you for confirmation before executing the command. For more information, type the following command: get-help about_commonparameters

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-DefaultQuotaTemplate

Specifies the new default site quota template for this web application.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-DefaultTimeZone

Specifies the default time zone for new site collections in this web application.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-DisableSMTPEncryption

Specifies whether to turn on or off SMTP Encryption.

The default value is false.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-Force

Suppresses confirmation messages involved in settings for a web application.

Type:SwitchParameter
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-HostHeader

Specifies the host header binding for this IIS website. A host header binding allows multiple IIS websites to share the same port number. Web requests sent to a shared port number are routed to the correct IIS website based on the value of the HTTP host header sent by the client.

If no host header binding is specified, then all web requests sent to this port number will be routed to this IIS website unless another IIS website has a host header binding that matches the HTTP host header sent by the client.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-Identity

Specifies the name or URL of the web application.

The type must be a valid name, in the form WebApplication-1212, or URL, in the form https://example.contoso.com.

Type:SPWebApplicationPipeBind
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-NotProvisionGlobally

Only provisions the web application on the local server with the changes specified by this cmdlet. Web applications on other servers in the farm will not be provisioned with these changes.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-OutgoingEmailAddress

Specifies the new outgoing e-mail address for e-mail messages sent from this web application. The type must be a valid address; for example, someone@example.com.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-Port

Specifies the port on which this web application can be accessed. This can be any valid port number.

If you specify a port number that has already been assigned, IIS does not start the new site until you change either the port number of the new site or the port number of the old site.

Type:Int32
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-ReplyToEmailAddress

Configures the reply e-mail address.

The type must be a valid address; for example, someone@example.com.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-SecureSocketsLayer

Enables Secure Sockets Layer (SSL) encryption for this web application. If you choose to use SSL, you must import a server certificate to SharePoint and assign it to the IIS website for this web application. Until this is done, the web application will be inaccessible from this IIS website.

The default value is False.

If this parameter is omitted or set to False, this web application will use HTTP for the specified port.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-ServiceApplicationProxyGroup

Specifies a custom service application proxy group for the web application to use. The web application will use the proxies in this proxy group to connect to service applications. If this parameter is not specified, the farm's default proxy group is used.

Type:SPServiceApplicationProxyGroupPipeBind
Aliases:ProxyGroup
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-SignInRedirectProvider

Sets the sign-in redirect URL to point to the URL that is defined in the specified authentication provider.

Type:SPTrustedIdentityTokenIssuerPipeBind
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-SignInRedirectURL

Specifies the sign-in redirect URL for the web application.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-SMTPCredentials

Specifies credentials to authenticate to the SMTP server. Set the value to $null to connect to the SMTP server anonymously. If this parameter isn't specified, the existing authentication settings will be preserved.

You must use the Set-SPApplicationCredentialKey PowerShell cmdlet to set an identical application credential key on each server in the farm before specifying credentials.

Type:PSCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-SMTPServer

Specifies the new outbound SMTP server that this web application will use. Set to $null to clear the server setting.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-SMTPServerPort

Specifies a SMTP port value.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Url

Specifies the load-balanced URL for the web application zone.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-UseServerNameIndication

Specifies that the Secure Sockets Layer (SSL) binding of this IIS website should use Server Name Indication (SNI). Server Name Indication allows multiple IIS websites with unique host headers and unique server certificates to share the same SSL port. If Server Name Indication isn't used, all IIS websites sharing the same SSL port must share the same SSL certificate.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-WhatIf

Displays a message that describes the effect of the command instead of executing the command. For more information, type the following command: get-help about_commonparameters

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-Zone

When configuring zone-specific settings, the zone to configure must be specified. This zone must already exist.

The type must be any one of the following values: Default, Intranet, Internet, Extranet, or Custom.

Type:SPUrlZone
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition