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 want to create a PowerShell-script that can list the actual size of a SharePoint site-collection (among other infos) and export that to CSV.
Writing that script i discovered that there's more than one way to get the "size" of a site-collection:

  1. SPSite.UsageInfo.Storage
    "Contains the total amount of storage in bytes that is consumed by the site collection" http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsite.usageinfo.storage.aspx
  2. SPSiteAdministration.DiskUsed
    "Gets a value indicating the amount of disk space used by the site collection"
    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spsiteadministration.diskused.aspx

In my experience the SPSiteAdministration.DiskUsed is larger than the SPSite.UsageInfo.Storage in most cases, while sometimes they both return the same value.

So, can somebody explain what exactly the difference is ?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

I +1'd Anders answer because it's the right way to approach what you want to do, but to your point it doesn't address your question of what's the different between "amount of storage in bytes" and "amount of disk space used".

There's two possible reasons for this as I see it:

1) UsageInfo is calculated real-time, as data is added or removed from a site collection. Whereas I believe DiskUsed is calculated at a set interval as part of a maintenance job.

2) UsageInfo may not count items in the stage 2 recycle bin, as they are not counted towards quotas. Only items in the stage 1 recycle bin are counted towards quotas.

share|improve this answer

Take a look at the SPSite.Usage property

Todd Klindt have an example of a script that does close to what you want here.

share|improve this answer
    
that post is close to how i started, and i have finished the script in the meantime - but it does not answer my question! Why is the 'amount of storage in bytes' in most cases lower than the 'amount of disk space used'? –  user1730 Aug 12 '11 at 7:29

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.