Answered by:
Powershell Command to get disk space used by SiteCollection returns null

-
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.
Question
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
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!!
-
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 -
-
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
-