Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a site collection with inside of it alot of sub site collection for each mysite instance. I would like to create a powershell foreach script which will set a quota template to each site collection. Can someone help me please?

share|improve this question
    
What is your question? Where are you stuck? –  Mike Oryszak Apr 10 '13 at 12:54

1 Answer 1

up vote 3 down vote accepted

To use a quota template, you need to have it's GUID to be able to use it in the following second script. The other method would be to use -MaxSize and -WarningSize attributes, which is usually what you use quota for.

Either you use the following script with the attributes:

$SPWebApp = Get-SPWebApplication http://portal

foreach ($SPSite in $SPWebApp.Sites)
{
    if ($SPSite -ne $null)
    {
        Set-SPSite -Identity $SPSite.url -MaxSize 4000000 -WarningSize 2000000
        $SPSite.Dispose()
    }
}

Or if you have a reference to the QuotaTemplate use the following script:

$SPWebApp = Get-SPWebApplication http://portal

foreach ($SPSite in $SPWebApp.Sites)
{
    if ($SPSite -ne $null)
    {
        Set-SPSite -Identity $SPSite.url -QuotaTemplate "12345678-90ab-cdef-1234-567890abcdef"
        $SPSite.Dispose()
    }
}

A quota template defines a space limit, the type of quota (hard or soft), and (optionally) a set of notifications that will be generated automatically when quota usage reaches defined threshold levels.

By creating quotas exclusively from templates, you can centrally manage your quotas by updating the templates instead of replicating changes in each quota. This feature simplifies the implementation of storage policy changes by providing one central point where you can make all updates.


References:

share|improve this answer
    
what do I need to set in "<Template>" ? –  KHA Apr 10 '13 at 15:10
    
@KHA Preferrably a GUID referenceing the QuotaTemplate you want to use. Se my edited answer for more information. –  Benny Skogberg MCSA Apr 10 '13 at 18:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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