Created
June 25, 2013 11:27
-
-
Save janikvonrotz/5857772 to your computer and use it in GitHub Desktop.
PowerShell: Set Browser File Handling For SharePoint Webapplication
#PowerShell
#SharePoint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get all webapplications | |
$SPWebApps = Get-SPWebApplication | |
# set browser mime type | |
$mimeType = "application/pdf" | |
$SPWebApps | foreach-object { | |
# If the MIME Type is not already on the allowed list for the Web Application | |
if(!$_.AllowedInlineDownloadedMimeTypes.Contains($mimeType)){ | |
# Add the MIME type to the allowed list and update the Web Application | |
$_.AllowedInlineDownloadedMimeTypes.Add($mimeType) | |
$_.Update() | |
Write-Host Added $mimeType to the allowed list for Web Application $_.Name | |
}else{ | |
# The MIME type was already allowed - can't add. Inform user | |
Write-Host Skipped Web Application $_.Name - $mimeType was already allowed | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get all webapplications | |
$SPWebApps = Get-SPWebApplication | |
# set browser mime type | |
$mimeType = "application/pdf" | |
$SPWebApps | foreach-object { | |
# If the MIME Type is on the allowed list for the Web Application | |
if($_.AllowedInlineDownloadedMimeTypes.Contains($mimeType)){ | |
# Remove the MIME type from the allowed list and update the Web Application | |
$_.AllowedInlineDownloadedMimeTypes.Remove($mimeType) | Out-Null | |
$_.Update() | |
Write-Host Removed $mimeType from the allowed list of Web Application $_.Name | |
}else{ | |
# The MIME type was not on the list - can't remove. Inform user | |
Write-Host Skipped Web Application $_.Name - $mimeType was not on the allowed list | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get all webapplications | |
$SPWebApps = Get-SPWebApplication | |
# set global file handling | |
$SPWebApps | foreach-object { | |
if($_.BrowserFileHandling -ne "strict" ){ | |
$_.BrowserFileHandling = "strict" | |
$_.Update() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment