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 version