Showing posts with label SharePoint 2010. Show all posts
Showing posts with label SharePoint 2010. Show all posts

Wednesday, June 4, 2014

Get SharePoint 2013 Site Collection Size Using PowerShell

I was trying to get the usage size for one of the SharePoint personal sites, and I ended up with this script.
The script is for getting all site collections usage compared to its maximum size, sorted by size of the Site Collections and the output to a HTML file.

$a = "<style>"
$a = $a + "TABLE{border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;}"
$a = $a + "TH{border-width: 1px;padding: 1px;border-style: solid;border-color: black;}"
$a = $a + "TD{border-width: 1px;padding: 1px;border-style: solid;border-color: black;}"
$a = $a + "</style>"

Get-SPSite -Limit All | select url, @{label="Size in MB";Expression={$_.usage.storage/1MB}},@{label="Capacity";Expression={$_.Quota.StorageMaximumLevel/1MB}} | Sort-Object -Descending -Property "Size in MB" | ConvertTo-Html -Head $a -title "Site Collections sorted by size" | Set-Content sc.html


Cheers,

Tuesday, March 25, 2014

Getting the GUID of a SharePoint site collection

You can get the GUID by the following ways:
1-   Powershell (SharePoint 2010):
PS > $mysite =  Get-SPSite <SITE_URL>
PS > $mysite.id

2-   Stsadm Command Line (MOSS 2007 & SharePoint 2010):
Stsadm -o enumsites -url <SITE_URL>

3-   SQL Server (MOSS 2007 & SharePoint 2010):
Run the following query on the designated content db:
select SiteId from Webs where webs.FullUrl Like '<SITE_URL>' AND ParentWebId IS NULL