Posted on:
Categories: PowerShell;SharePoint
Description:

Minimal Download Strategy (MDS) ​is a new technology in SharePoint 2013 that reduces the amount of data that the browser has to download when users navigate from one page to another in a SharePoint site.

MDS is a site scoped feature that is activated by default on all sites.

This may cause compatibility issues with 3rd party load balancers, reverse proxies or developed customizations.

Without a customized site template, ensuring all new sites do NOT have this enabled may be a challenge.

If you are in need of disabling this feature, you can use the below script at an interval of your choosing to disable MDS on all sites.

The script will log it's actions on what it changed nightly to a log file in a destination of your choice.

 

 

$fullFilePath = c:\Scripts\DisableMDS\DisableMDSLog.txt

Remove-Item -Force -LiteralPath $fullFilePath -ErrorAction SilentlyContinue

Add-PsSnapin Microsoft.SharePoint.PowerShell -ea 0

$OutString = "Script Running at " + (Get-Date);
$OutString | Out-File -FilePath $fullFilePath -Append

$WebApps = Get-SPWebApplication | Where-Object {$_.Url -notlike "*my*"}

ForEach($WebApp in $WebApps){
 ForEach($Site in $WebApp.Sites){
  $OutString = "Checking Site-Collection: " + $Site.Url;
  $OutString | Out-File -FilePath $fullFilePath -Append
  ForEach($Web in $Site.AllWebs)
   {
   $OutString = "    Checking Sub-Site: " + $Web;
   $OutString | Out-File -FilePath $fullFilePath -Append
                If($Web.EnableMinimalDownload -eq 1)
    {
     $OutString = "        MDS is Enabled for this site. Disabling";
     $OutString | Out-File -FilePath $fullFilePath -Append
     Disable-SPFeature -Identity MDSFeature -URL $Web.URL -confirm:$false
    }
     Else
    {
     $OutString = "    Skipping: " + $Web;
     $OutString | Out-File -FilePath $fullFilePath -Append
    }
   }
  $Web.Dispose();
  }
 $Site.Dispose();
}