I needed to modify certain settings for a given SharePoint Web Application. I’ve taken the habit to figure out a way to achieve things through Powershell, instead of just sleepily clicking through Central Administration. It’s a bit slower but provides me with a useful way to figure out the internals of the Powershell provider for SharePoint.
The setting I needed to modify is Enable Client Integration, which is enabled by default. For anonymous users on public-facing sites, this should be disabled. Non-authenticated users should not need to use client applications such as Word in our scenario. The setting can be changed in Central Administration under Application Management > Manage web applications > Select a web app and then click Authentication Providers in the ribbon:
For my test box I’m using Windows-authentication for the Default zone. By clicking the zone name (Default), I can verify the current value of Enable Client Integration:
To change this value through Powershell, I have to dabble with the dreaded IisSettings-property, which is exposed as a collection. The following is a snippet from the Powershell function I wrote to make the change happen:
1: $wa = Get-SPWebApplication $webapp.Url
2: # set EnableClientIntegration to $true or $false
3: $wa.IisSettings.Keys | % { ($wa.IisSettings[$_]).EnableClientIntegration = $false; $wa.Update(); }
4: $wa.ProvisionGlobally();
By setting EnableClientIntegration to $false I’m able to force SharePoint, for a given web app, to disable the setting. For any changes done for IisSettings I have to provision them for the farm with ProvisionGlobally().
SharePoint now detects changes to IIS and automatically unloads the application pool for the web application that was modified:
The application domain /LM/W3SVC/253447295/ROOT-1-129727257347745584 is unloading and going to be recycled.
The shutdown reason is verbose, to put it politely:
Shutdown Reason: Change Notification for critical directories. App_Browsers dir change or directory rename HostingEnvironment initiated shutdown Change Notification for critical directories. App_Browsers dir change or directory rename Change Notification for critical directories. App_GlobalResources dir change or directory rename Change Notification for critical directories. App_GlobalResources dir change or directory rename Change Notification for critical directories. App_GlobalResources dir change or directory rename Change Notification for critical directories. App_GlobalResources dir change or directory rename Change Notification for critical directories. App_GlobalResources dir change or directory rename Change Notification for critical directories. App_GlobalResources dir change or directory rename Change Notification for critical directories. App_GlobalResources dir change or directory rename Change Notification for critical directories. App_GlobalResources dir change or directory rename Change Notification for critical directories. App_GlobalResources dir change or directory rename Change Notification for critical directories. App_GlobalResources dir change or directory rename Change Notification for critical directories. App_GlobalResources dir change or directory rename Change Notification for critical directories. App_GlobalResources dir change or directory rename Change Notification for critical directories. App_GlobalResources dir change or directory rename HostingEnvironment caused shutdown Change Notification for critical directories. App_GlobalResources dir change or directory rename Change Notification for critical directories. App_GlobalResources dir change or directory rename
Refreshing Central Administration now reveals the change: