I have a script updating users -QutaTemplate when the default quota is changed.

But the problem is that it's also updating users who have individual quotas set. How can I get the name of the QuotaTemplate that is used on each user in the foreach loop, to skip those?

This is my current script:

$webApp = Get-SPWebApplication http://xxx.xxx.xxx

foreach($site in $webApp.Sites) {   

    # Skip the root url
    if($site.Url -eq "http://xxx.xxx.xxx") {

    Write-Host $site.Url
    Set-SPSite -Identity $site.Url -QuotaTemplate “Quota Name”

1 Answer 1


You can get the Id of the quota from the Quota property on the SPSite object. You can get the name from the Administration service:

$quotaId = $site.Quota
$cs =[Microsoft.SharePoint.Administration.SPWebService]::ContentService
$quotaName = $($cs.QuotaTemplates | Where {$_.QuotaID -eq $quotaId}).Name
  • Just one edit to your code, in the first line, you need to add .QuotaID ($site.Quota.QuotaID).
    – Svein Erik
    Nov 28, 2016 at 7:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.