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
$used
For a larger script I would use the pipeline version and not mess with memory management.