Bill Baer /bɛːr/

Skip to main content


Bill Baer /bɛːr/
Bill Baer is a Senior Product Manager for Microsoft Search, Assistant, and Intelligence and Microsoft Syntex at Microsoft in Redmond, Washington.

Quota Templates and Powershell

Quota Templates and Powershell

Quota Templates and Powershell

  Code Samples Windows Powershell

Continuing the series using Powershell and Microsoft SharePoint Products and Technologies, this weeks script sample illustrates how Powershell can be leveraged to programmatically provision Quota Templates in Windows SharePoint Services 3.0 and/or Microsoft Office SharePoint Server 2007.


  1. Copy the source below into somefile.ps1.
  2. Copy the Xml source in QuotaTemplates.xml.
  3. In the Windows Powershell console call ./somefile.ps1


# Function:    main

# Description:    Main entry point for the script.  Loads the configuration source
#        Xml and initializes the foreach loop to iterate over a
#         collection of Xml nodes.

# Parameters:    None

function main()
  [xml]$cfg = Get-Content .QuotaTemplates.xml

  if( $? -eq $false ) {
    Write-Host “Cannot load configuration source Xml $cfg.”
    return $false

  $cfg.Configuration.QuotaTemplates.QuotaTemplate | ForEach-Object {
    new-QuotaTemplates( $_ )

# Function:     new-QuotaTemplates

# Description:     This script enables you to do programmatically what you can do
#         manually through the user interface in the SharePoint Site
#         Management section on the Central Administration Quota
#         Templates page.

# Parameters:     None

function New-QuotaTemplates( [object] $cfg )

  $webService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
  $quota=New-Object Microsoft.SharePoint.Administration.SPQuotaTemplate

  $quota.Name = $cfg.Name
  $quota.StorageMaximumLevel = $cfg.StorageMaximumLevel
  $quota.StorageWarningLevel = $cfg.StorageWarningLevel




Source Xml

              2097152000       1887436800               3145728000       2936012800               4194304000       3670016000               5242880000       4718592000               10485760000       9961472000               104857600000       99614720000      
| | Permalink to this article
Fingerprint for this articlea5d37168162dd4baddbda2c215338e47


Skip to footer

Social Links