none
Powershell Command to get disk space used by SiteCollection returns null

    Question

  • I am using the following powershell command

     

    $used = (Get-SPSiteAdministration -Identity "https://myspfarm/sites/testsite").DiskUsed
    
    

    However when I type in $used it just returns blank. I can confirm that my URL is correct!!

    Also, if I change the command to some invalid URL then I get an error

    but still $used is blank.

    Why??? is there a bug in SP2010? if you have a https site, could you please test this command out?

    PS: I have right clicked and "Run as Administartor" for launching the SP2010 Powershell window.

    Monday, February 07, 2011 1:55 PM

Answers

  • I solved the issue myself. Before I execute anything, I should say

    Start-SPAssignment -Global

    after this the script published above worked correctly.

    • Marked as answer by MSDN Student Tuesday, February 08, 2011 12:40 PM
    Tuesday, February 08, 2011 12:39 PM

All replies

  • to make matters more funny... its not that this powershell command is returning me null

    If I type

    $test = (Get-SPSiteAdministration -Identity "https://myspfarm/sites/testsite" -Regex)

    then do a

    $test | Get-Member I see

    PS C:\Users\user1> $test | Get-Member


       TypeName: Microsoft.SharePoint.Administration.SPSiteAdministration

    Name                      MemberType Definition
    ----                      ---------- ----------
    AddWeb                    Method     System.Void AddWeb(string strWebUrl, string strTitle, string strDescription, Sy...
    ApplyWebTemplate          Method     System.Void ApplyWebTemplate(string strWebTemplate)
    Delete                    Method     System.Void Delete(), System.Void Delete(bool bDeleteADAccounts), System.Void D...
    Dispose                   Method     System.Void Dispose()
    Equals                    Method     bool Equals(System.Object obj)
    GetHashCode               Method     int GetHashCode()
    GetType                   Method     type GetType()
    ToString                  Method     string ToString()
    AdministrationSiteType    Property   Microsoft.SharePoint.SPAdministrationSiteType AdministrationSiteType {get;set;}
    AverageResourceUsage      Property   System.Double AverageResourceUsage {get;}
    CurrentResourceUsage      Property   System.Double CurrentResourceUsage {get;}
    Description               Property   System.String Description {get;}
    DiskUsed                  Property   System.Int64 DiskUsed {get;}
    LockIssue                 Property   System.String LockIssue {get;set;}

     

    So $test variable not null.

    But If I do

    $test.DiskUsed

    $test.Title

    $test.Url

    everything is blank!!

    $test.FakeVariable is blank!!

     

     

    Monday, February 07, 2011 2:21 PM
  • Does the site collection have a quota assigned to it?  I know that in the UI, you can't see that info unless the SC has a quota.  I would try that.

     


    --Paul Galvin, Computer Generated Solutions (CGS)
      Microsoft MVP - SharePoint
      Blogging @ http://www.mstechblogs.com/paul
      Twitter @ http://www.twitter.com/pagalvin
    Monday, February 07, 2011 3:37 PM
  • I went and set the "Individual Quota for my site collection to 100000 MB

    but still all properties of (Get-SPSiteAdminstration -Identity "https://myspfarm/sites/tessite") are empty

     

    Tuesday, February 08, 2011 10:58 AM
  • I solved the issue myself. Before I execute anything, I should say

    Start-SPAssignment -Global

    after this the script published above worked correctly.

    • Marked as answer by MSDN Student Tuesday, February 08, 2011 12:40 PM
    Tuesday, February 08, 2011 12:39 PM
  • I also tried with the option you mentioned,I am seeing all my properties Blank.Is there any additional steps need to be done
    Friday, May 27, 2011 12:56 PM