Applying Quotas Across all My Sites

Just a quick snippet this morning. If you need to apply a new quota template to all users My Sites here's a quick script to do it. Changing an existing quota is fine but if you're migrating users from another system or you just want to up everyone's storage a bit here's what you do.

  1. Create a new quota template. This is found in Central Admin under Application Management | Site Collections | Specify quota templates. There's already a default "Individual Quota" created you might want to create your own or have a special one for your users
  2. Open up the PowerShell Management Console and enter "Get-SPWebApplication". This will list all your web applications on the farm. 
  3. To apply it to all My Sites (each site is a site collection of its own) run this script below.

   1:  $webapps = Get-SPWebApplication;
   3:  $webapp = $webapps[4];
   5:  foreach ($site in $webapp.Sites) {
   6:      Set-SPSite -Identity $site.url -QuotaTemplate "Your Quota Template"
   7:  }

The first line gets all the web applications on the server. In our case, the forth one is the mysite web app (yours will probably be a different number). Just run Get-SPWebApplication from the console to figure out which one to use. You could get fancy and pipe the name to find it but I'm too lazy for that.

Then we loop through all the sites on the list using the $site.url property and pass it to the Set-SPSite cmdlet and specify the name of the our custom QuotaTemplate.

Easy. Now all users are updated with the new quota template.


Comments have been disabled for this content.