Blocking File Types In SharePoint 2016

You can restrict file types from being uploaded or downloaded in SharePoint 2013. Each web application maintains a list of blocked file types that is based on file name extensions.

Today, I will walk you through the process / steps to manage the Blocked File types in SharePoint 2016. We can manage them via Central Admin or PowerShell.

Another welcome change in the SharePoint 2016 is, they reduce the number of blocked file types from previous versions of SharePoint. It is totally different than the SharePoint 2010 / 2013. In SharePoint 2013, there are 105 default file types that are blocked by default but in SharePoint 2016, this number goes all the way down to 6. Interestingly, there is no blocked file type in SharePoint Online.

Scenario

In our company, there is requirement to block the ‘exe’ file extensions from being uploaded to SharePoint.

Manage the File Types Using Central Administration.

Here are the steps.
  1. Log on to Central Admin website using the Farm Administrator account.
  2. In Central Administration, click "Security".
  3. On the Security page, in the "General Security" section, click "Define blocked file types". 



  4. If you want to change the selected web application (1), on the Web Application menu, click "Change Web Application". Use the "Select Web Application" page to select a web application.
  5. Do one of the following:

To Block

  1. To block an additional file type, scroll to the bottom of the page and type each file name extension on a separate line text box, type the file name extension (2) that you want to block, and then click OK (3).


To Remove

  1. To stop blocking a file type, select a file type from the list, press the "Delete" key, and then click "OK".

    Note - You do not have to type a file name extension in the list in alphabetical order. The next time you open the list, the file name extension you have added will be correctly sorted in alphabetical order.

Manage the File Types using PowerShell

Please follow the below Steps:

  • Launch the SharePoint PowerShell Window as “Run as Administrator”.

To view existing blocked file extension

  • In PowerShell window, run the following command.
    1. $webapp = Get - SPWebApplication“ Url of the Web Application”  
    2. $ext = $webapp.BlockedFileExtensions  
    3. Write - Host“ List of Block File extensions are” $ext - ForegroundColor“ Blue”  

To add existing blocked file extension

  • In PowerShell window, run the following command.
    1. $webapp = Get - SPWebApplication“ Url of the Web Application”  
    2. $ext = $webapp.BlockedFileExtensions  
    3. $ext.Add(“exe”)  
    4. $webapp.update()  

To remove existing blocked file extension

  • In PowerShell window, run the following command.
    1. $webapp = Get - SPWebApplication“ Url of the Web Application”  
    2. $ext = $webapp.BlockedFileExtensions  
    3. $ext.Remove(“exe”)  
    4. $webapp.Update()  

Reference

For complete code, please visit the TechNet Gallery below