Planet Technologies

Modify Web Application Settings with PowerShell

Email | Print

Overview

The SharePoint Web application has a number of settings that you can customize. These settings fall within a number of different group: General, Resource Throttling, Workflow, Email. While it is easy to configure each of these through the UI, you can alternatively elect to modify them through PowerShell.

This approach will allow you to have a consistent set of configurations for all of your SharePoint Web Applications without having to manually go through the UI to configure them.

In order to modify these settings, we simply need to use the Get-SPWebApplication cmdlet to retrieve the Web Application object, which will be assigned to a variable. Microsoft doesn’t provide a cmdlet to modify the actual application settings, but we do have access to the Microsoft.SharePoint.Administration.SPAdministrationWebApplication object.

Once you have made the modification you need, you must call the Update() method. Below is an example of a script that shows how to modify many of the settings.

The Script

$siteURL = “http://lab.ps4sp.com”

$webApp = Get-SPWebApplication $siteURL

# General Settings

$webApp.DefaultTimeZone = 12; # Mountain Time

$webApp.PresenceEnabled = $true

$webApp.AlertsEnabled = $true

$webApp.AlertsMaximum = 500

$webApp.SyndicationEnabled = $true

$webApp.MetaWeblogEnabled = $false

$webApp.MetaWeblogAuthenticationEnabled = $true

$webApp.BrowserFileHandling = [Microsoft.SharePoint.SPBrowserFileHandling]::Strict; # Permissive or Strict

$webApp.SendLoginCredentialsByEmail = $false

$webApp.MasterPageReferenceEnabled = $true

$webApp.MaximumFileSize = 100

$webApp.RecycleBinEnabled = $true

$webApp.RecycleBinCleanupEnabled = $true

$webApp.RecycleBinRetentionPeriod = 15

$webApp.SecondStageRecycleBinQuota = 25

$webApp.BrowserCEIPEnabled = $false

# Resource Throttling

$webApp.MaxItemsPerThrottledOperation = 5000

$webApp.MaxItemsPerThrottledOperationOverride = $true

$webApp.MaxItemsPerThrottledOperationWarningLevel = 2000

$webApp.MaxListItemRowStorage = 8

$webApp.MaxQueryLookupFields = 0

$webApp.DailyStartUnthrottledPrivilegedOperationsHour = 17

$webApp.DailyStartUnthrottledPrivilegedOperationsMinute = 0

$webApp.DailyUnthrottledPrivilegedOperationsDuration = 1

$webApp.IsBackwardsCompatible = [Microsoft.SharePoint.TriState]::false

$webApp.ChangeLogExpirationEnabled = $false

# Workflows

$webApp.UserDefinedWorkflowsEnabled = $true

$webApp.EmailToNoPermissionWorkflowParticipantsEnabled = $true

$webApp.ExternalWorkflowParticipantsEnabled = $false

# Email

$webApp.OutBoundMailReplyToAddress = “[email protected]

$webApp.OutboundMailSenderAddress = “[email protected]

$webApp.IncomingEmailServerAddress = “mail.ps4sp.com”

# Designer

$webApp.AllowDesigner = $true

$webApp.AllowRevertFromTemplate = $true

$webApp.AllowMasterPageEditing = $true

$webApp.ShowURLStructure = $true

$webApp.Update()

Summary

A SharePoint Farm may consist of many SharePoint Web Applications. To ensure consistency between your web applications, you can either use the SharePoint UI or PowerShell. The UI does not give you an easy way to review all of these settings at one time and you would have to visit each SharePoint Web Application one at a time.

While there are quite a few lines of code, you will only need to use the lines that are making changes to the default values in your web application. The above example shows the available settings to help give you an idea of the settings that can be configured through PowerShell.

Written by: Shannon Bray, Chief SharePoint Architect for Planet Technologies, SharePoint 2010 Microsoft Certified Master (MCM)

Related Posts



Ask This Expert a Question or Leave a Comment