Tag Archives: script

Microsoft Script Explorer for Windows Powershell

Microsoft released a pre-release of a tool called Microsoft Script Explorer for Windows Powershell. In essence, it’s a tool that helps you find scripts, modules and guidance on using Powershell against Microsoft (server) products – such as SharePoint, SQL Server and Windows Server.

You can download the tool here.

There’s a guide available already (see here) but the tool is rather simple, so you’d only need the guide to learn about the advanced search syntax and setting up a network repository.

Modifying SharePoint Web Application settings may cause application pool recycle

Large glass of whisky on the rocksI 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:

image

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:

image

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:

image