Enable/Disable Client Integration using SharePoint 2010 Object Model

Thanks to Dhirendra Yadav for posting how to set the “Enable Client Integration” property using the SharePoint 2010 OM. I’m reposting here because I had a little trouble finding his post initially. And thought it’s not a big deal to convert it, I’ve put the code into something runnable from your PowerShell command window.

Here is Mr. Yadav’s original code:

 using (SPSite siteCollection = new SPSite(https://{your site url})) {
   
  //enable client integration 
  siteCollection.WebApplication.IisSettings[SPUrlZone.Default].EnableClientIntegration = true;
   
  //disable client integration 
  siteCollection.WebApplication.IisSettings[SPUrlZone.Default].EnableClientIntegration = false;

  siteCollection.WebApplication.Update();

}
  
 And here is my version, converted for use via PowerShell:
   // Initiate a new assignment store so we can clean up our SP objects afterward
   $gc = Start-SPAssignment
   // get a specific Site Collection
   $s = $gc | Get-SPSite https://{your site url}
  
   // Use the IisSettings object on the WebApplication to update EnableClientIntegration
   // enable client integration
   $s.WebApplication.IisSettings[[Microsoft.SharePoint.Administration.SPUrlZone]::Default].EnableClientIntegration = $true
  
   // disable client integration
   $s.WebApplication.IisSettings[[Microsoft.SharePoint.Administration.SPUrlZone]::Default].EnableClientIntegration = $true
  
   // Make sure to call update on the Web Application
   $s.WebApplication.Update()
  
   // And dispose of the SPAssignment (i.e. the Site Collection object)
   Stop-SPAssignment –Identity $gc