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

Wednesday, August 21, 2013

Windows PowerShell Script to get Site Collections Quota in a Farm


We have a requirement to get the list of all the Site collections along with their Site quotas.
Below Windows PowerShell script will output the following information,
 
  • Site URL
  • Assigned/Allocated Site Quota Size
  • Total Storage User
You can copy the below script into a notepad and edit the OutputFile and Siteurl as needed in your environment save the file as Script.PS1. You can also paste the code in the SharePoint 2010 Management Shell. (Keep in mind to run as Administrator)
 

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
#Configure the location for the SiteCollectionQuota output file
$OutputFile="C:\SiteCollectionsQuota.csv";
"Site URL"+","+"Quota Limit (MB)"+","+"Total Storage Used (MB)"+"" | Out-File -Encoding Default -FilePath $OutputFile;
#Specify the root site collection within the Web app
$Siteurl="Your web application URL";
$Rootweb=New-Object Microsoft.Sharepoint.Spsite($Siteurl);
$Webapp=$Rootweb.Webapplication;
#Loops through each site collection within the Web app
Foreach ($Site in $Webapp.Sites)
{if ($Site.Quota.Storagemaximumlevel -gt 0) {[int]$MaxStorage=$Site.Quota.StorageMaximumLevel /1MB} else {$MaxStorage="0"};
if ($Site.Usage.Storage -gt 0) {[int]$StorageUsed=$Site.Usage.Storage /1MB};
if ($Storageused-gt 0 -and $Maxstorage-gt 0){[int]$SiteQuotaUsed=$Storageused/$Maxstorage* 100} else {$SiteQuotaUsed="0"};
$Web=$Site.Rootweb; $Site.Url + "," +$MaxStorage+","+$StorageUsed | Out-File -Encoding Default -Append -FilePath $OutputFile;$Site.Dispose()};

 Reference: SharePoint Server 2010 Windows PowerShell cmdlets, http://technet.microsoft.com/en-us/library/ff678226(v=office.14).aspx

Monday, April 2, 2012

There were problems searching audience, please contact the system administrator

In SharePoint 2010, when I tried to add/set Audience to the Navigation links, I kept getting the below error,

There were problems searching audience, please contact the system administrator
After spending some time in trouble shooting I noticed “User Profile Service Application Proxy” is not associated with the web application
Followed below steps to fix the issue,
Navigate to CA
àManage Web Application
Select  “Web Application” that you are noticing the issues with the audiences.
In the Ribbon, Under Manage section click on “Service Connections
Make sure that “User Profile Service Application Proxy” is checked by selecting custom.
After the above configuration step error disappeared and I was able to set the audiences to the Navigation links.