You can restrict the file types from being uploaded or downloaded in SharePoint 2013. Each web application maintains a list of the blocked file types that is based on file name extensions. Today, I will walk through the process / steps to manage the Block File types in SharePoint 2016. We can manage them via Central Admin or PowerShell.
Scenario
In our company, there is a requirement to block the ‘EXE’ file extensions from being uploaded to SharePoint.
Manage the file types, using Central Administration.
Here are the steps.
- Log on to Central Admin's Website, using the Farm Administrator account.
- In Central Administration, click Security.
- On the Security page, in the General Security section, click Define blocked file types.
- On the Blocked File Types page, 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.
- Do one of the following,
- To Block
To block an additional file type, scroll to the bottom of the Type each file name extension on a separate line text box, type the file name extension(2), which you want to block and then click OK(3).
- To Remove
To stop blocking a file type, select a file type from the list, press 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 that you open the list, the file name extension you added will be correctly sorted in an alphabetical order.
Manage the File Types Using PowerShell
Please follow the steps, mentioned below.
- Launch SharePoint PowerShell Windows as “Run as Administrator”.
To View Existing Block File Extension
In PowerShell Windows, please run the command, mentioned below.
- $webapp = Get-SPWebApplication “Url of the Web Application”
- $ext = $webapp.BlockedFileExtensions
- Write-Host “List of Block File extensions are” $ext -ForegroundColor “Blue”
To add an existing Block File ExtensionIn PowerShell Window, please run the command, mentioned below.
In PowerShell windows please run the following command.
- $webapp = Get-SPWebApplication “Url of the Web Application”
- $ext = $webapp.BlockedFileExtensions
- $ext.Add(“exe”)
- $webapp.update()
To Remove Existing Block File Extension
In PowerShell Windows, run the command, mentioned below.
- $webapp = Get-SPWebApplication “Url of the Web Application”
- $ext = $webapp.BlockedFileExtensions
- $ext.Remove(“exe”)
- $webapp.Update()
For complete code, please visit the Technet Gallery at SharePoint 2016 Block File Type Operations PowerShell.