Could anyone suggest why Get-SPSiteAdministration cmdlet does not return any data while the site collection exists?

$used = (Get-SPSiteAdministration -Identity "http://site-collection").DiskUsed


Get-SPSiteAdministration -Identity "http://site-collection"

returns this site-collection.

1 Answer 1


Apparently, what is happening is that a SPSiteAdministration object is returned but immediately disposed again since the pipeline is finished. This might be surprising but this is the default behavior. Refer to the documentation of the Start-SPAssignment cmdlet. There are two possible solutions: Use the returned object in a pipeline or prevent the disposal.

Using a pipeline

This is the preferred (and intended) way which is optimal in terms of memory usage.

The documentation for Get-SPSiteAdministration shows EXAMPLE 1 which uses the returned object in a pipeline. Adapting the example would lead to:

Get-SPSiteAdministration -Identity "http://site-collection" | Select -Property DiskUsed

Prevent the disposal

You can control the memory management in terms of assignment collections to prevent the returned object to be disposed. This aproach will get complex for larger scripts and is not advisable.

The documentation for Get-SPSiteAdministration shows EXAMPLE 2 which adds the returned object in the global assignment collection so it is not disposed. Adapting the example would lead to:

Start-SPAssignment -Global
$used = (Get-SPSiteAdministration -Identity "http://site-collection").DiskUSed
Stop-SPAssignment -Global


For a larger script I would use the pipeline version and not mess with memory management.

  • strange, but this version worked
    – blindpilot
    Jun 7, 2018 at 16:12
  • @blindpilot I added more details on why this works and what is going on.
    – helb
    Jun 8, 2018 at 6:53

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.