This script could be used to change upload file limit in specified Webapllication in SharePoint.
Changing the upload file limits need several steps by using GUI. So a script will be better instead.
This script contains one advanced function, Set-OSCMaximumFileSize. You can use this script in following ways:
Method 1:
Method 2:
Example 1: Set maximumfilesize to 30 MB on webapplication "http://win-lfseeatt8jr/"
Command: Set-OSCMaximumFileSize -WebApplication "http://win-lfseeatt8jr/"
-Size 30
Screenshot:
Here are some code snippets for your references.
#Get current maximumfilesize
$CurrentSize = $webapp.MaximumFileSize
#Get user's choice
$result = GetChoice $CurrentSize $Size
#If 'yes', then excute the following
if($result -eq 0 )
{
$webapp.MaximumFileSize = $Size
$webapp.update()
write-host "Set MaximumFileSize to $Size MB successfully. "
}
Else
{
write-warning "Action cancelled by user."
}
#Get current maximumfilesize $CurrentSize = $webapp.MaximumFileSize #Get user's choice $result = GetChoice $CurrentSize $Size #If 'yes', then excute the following if($result -eq 0 ) { $webapp.MaximumFileSize = $Size $webapp.update() write-host "Set MaximumFileSize to $Size MB successfully. " } Else { write-warning "Action cancelled by user." }
PowerShell
Windows Server 2008R2 or later versionMicrosoft All-In-One Script Framework is an automation script sample library for IT Professionals. The key value that All-In-One Script Framework is trying to deliver is Scenario-Focused
Script Samples driven by IT Pros' real-world pains and needs. The team is monitoring all TechNet forums, IT Pros' support calls to Microsoft, and script requests submitted to TechNet Script Repository. We collect frequently asked IT scenarios, and create script
samples to automate the tasks and save some time for IT Pros. The team of All-In-One Script Framework sincerely hope that these customer-driven automation script samples can help our IT community in this script-centric move.