I ran into an issue today where I needed to quickly pull the MaximumFileSize setting for every web application across my farms. I found lots of blogs that told me how to change the setting, but none that told me how to pull the information from the farm before I change it.
The UI method for this is simple, but cumbersome if you have multiple web apps and multiple farms. Simply go to Central Administration|Application Management|Manage Web Application and select the Web Application you want to look at. In the ribbon the General Settings button will light up and when you click on it you will get the menu that includes:
That great for single scenarios. I wanted a PowerShell option that would loop through every one of my web applications and give me a list that I can store, and also will give me a quick way to audit if someone has made an unauthorized change. Here is what I came up with:
The output looks like:
In a DevQA want all of my sites to have the same file upload size limit, so I can use the following script to set them all the same:
In a Production environment I want to have different upload size limits based upon what the function of the Web App is, so I will use a script that allows me to change the limit on each specific web app:
Why all the “add-pssnapin microsoft.sharepoint.powershell –ea 0”?
Easy answer to this is that I am generally the numbskull who forgets to pop open the correct PowerShell console (SharePoint 2010 Management Shell) on a server that I don’t usually log into, or I am using PowerShell ISE and haven’t configured a profile. The –EA 0 flag allows me to throw the command to load the snap-ins without errors showing up if they are already loaded. Makes for a cleaner overall experience.