SharePoint Tip of the Day – PowerShell snippet to disable mobile view for a specific web application

A good reminder to myself to exclude this from feature receiver and put it on separate PowerShell scripts that can be easily run only on specific environment(s).

$webApp = Get-SPWebApplication "" $configMod = New-Object Microsoft.SharePoint.Administration.SPWebConfigModification$configMod.Path = "configuration/system.web"$configMod.Name = "browserCaps"$configMod.Sequence = 0 $configMod.Type = 0$configMod.Value = "<browserCaps> </browserCaps>" $childConfigMod = New-Object Microsoft.SharePoint.Administration.SPWebConfigModification$childConfigMod.Path = "configuration/system.web/browserCaps" $childConfigMod.Name = "result"$childConfigMod.Sequence = 0$childConfigMod.Type = 0$childConfigMod.Value = "<result type=""System.Web.Mobile.MobileCapabilities, System.Web.Mobile, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a""/><filter>isMobileDevice=false</filter>"  $webApp.WebConfigModifications.Add($configMod)$webApp.WebConfigModifications.Add($childConfigMod)$webApp.Update()$webApp.Parent.ApplyWebConfigModifications()$webApp.WebConfigModifications.Clear()


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s