Translate

Thursday, August 21, 2014

PS Script to do the sizing which includes all versions

#-----------------------------------
cls
if ( (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null )
{
Add-PsSnapin Microsoft.SharePoint.PowerShell
}
$ErrorActionPreference="SilentlyContinue"
Stop-Transcript | out-null
$ErrorActionPreference = "Continue"
Start-Transcript -path C:\outputsize.txt -append
function GetWebSize ($Web)
{
[long]$subtotal = 0
foreach ($folder in $Web.Folders)
{
$subtotal += GetFolderSize -Folder $folder
}
$sitetotal=$subtotal
$SiteInGb = (($sitetotal/1024)/1024)/1024
$SiteInGb = "{0:N4}" -f $SiteInGb
write-host "," $Web.Url "," $SiteInGb ","
write-host "`r`n"
return $subtotal
function GetSubWebSizes ($Web)
{
[long]$subtotal = 0
foreach ($subweb in $Web.GetSubwebsForCurrentUser())
{
[long]$webtotal = 0
foreach ($folder in $subweb.Folders)
{
$webtotal += GetFolderSize -Folder $folder
}
$subsitetotal=$webtotal
$subsiteInGb = (($subsitetotal/1024)/1024)/1024
$subsiteInGb = "{0:N4}" -f $subsiteInGb
write-host "," $subweb.Url "," $subsiteInGb ","
write-host "`r`n"
$subtotal += $webtotal
$subtotal += GetSubWebSizes -Web $subweb
}
return $subtotal
function GetFolderSize ($Folder)
{
[long]$folderSize = 0
foreach ($file in $Folder.Files)
{
if ($file.Versions -ne $NULL -and $file.Versions.Count -gt 1) {
foreach ($version in $file.Versions)
{
$folderSize += $version.Size;
}
}
else {
$folderSize += $file.Length;
}
}
foreach ($fd in $Folder.SubFolders)
{
$folderSize += GetFolderSize -Folder $fd
}
return $folderSize
}

$web = Get-SPWeb $args[0]
[long]$total = 0
$total += GetWebSize -Web $web
$total += GetSubWebSizes -Web $web
$totalInMb = ($total/1024)/1024
$totalInMb = "{0:N4}" -f $totalInMb
$totalInGb = (($total/1024)/1024)/1024
$totalInGb = "{0:N4}" -f $totalInGb
write-host "Total size of all sites below" $StartWeb "is" $total "Bytes,"
write-host "which is" $totalInMb "MB or" $totalInGb "GB"
$web.Dispose()
Stop-Transcript
#--------------------------------------------
To run the above PowerShell - first copy the above code and save in a file with anyname.PS1 and fireup the PowerShell with administrator 
# how to run this script -
c:\>anyname.ps1 http://portal/
OR
c:\>anyname.ps1 http://portal/portal1
OR
c:\>anyname.ps1 http://portal/portal1/portal2


Monday, August 18, 2014

An SPRequest object was not disposed before the end of this thread.

An SPRequest object was not disposed before the end of this thread.  To avoid wasting system resources, dispose of this object or its parent (such as an SPSite or SPWeb) as soon as you are done using it.  Due to flags specified at object creation, this will not be freed until processed by garbage collection.  Allocation Id: {D7B164AB-A421-46AC-80C6-D119DBE511BB}  To determine where this object was allocated, set Microsoft.SharePoint.Administration.SPWebService.ContentService.CollectSPRequestAllocationCallStacks = true.


Solution - Related web application pool stop and start again and it works fine for me :)

Thursday, August 14, 2014

Dissecting the Office Web Apps cache in SharePoint 2010

http://www.wictorwilen.se/Post/Dissecting-the-Office-Web-Apps-cache-in-SharePoint-2010.aspx

http://blogs.catapultsystems.com/IT/archive/2010/08/26/co-authoring-in-sharepoint-2010-explained.aspx

Tuesday, August 12, 2014

Recommended SharePoint Related Tools

Recommended SharePoint Related Tools

http://gallery.technet.microsoft.com/The-SharePoint-Flavored-5b03f323    This link is external to TechNet Wiki. It will open in a new window. , the SharePoint Flavored Weblog Reader (SFWR) helps troubleshooting performance problems by analyzing the IIS log files of SharePoint WFEs.
http://gallery.technet.microsoft.com/PressurePoint-Dragon-for-87572ee1 This link is external to TechNet Wiki. It will open in a new window.  , PressurePoint Dragon for SharePoint 2013 helps executing performance tests.
http://gallery.technet.microsoft.com/Maxer-for-SharePoint-2013-52208636 This link is external to TechNet Wiki. It will open in a new window.  , a tool for checking capacity planning limits.
http://visualstudiogallery.msdn.microsoft.com/36a6eb45-a7b1-47c3-9e85-09f0aef6e879    This link is external to TechNet Wiki. It will open in a new window. , Muse.VSExtensions, a great tool for referencing assemblies located in the GAC.
http://www.quest.com/powergui-freeware/ This link is external to TechNet Wiki. It will open in a new window.  , helps with all your PowerShell development. In a SharePoint environment, there usually will be some.
http://powerguivsx.codeplex.com/ This link is external to TechNet Wiki. It will open in a new window.  , Visual Studio extension based on PowerGUI that adds PowerShell IntelliSense support to Visual Studio.
http://visualstudiogallery.msdn.microsoft.com/4784e790-32f4-455f-9228-53f537c03787 This link is external to TechNet Wiki. It will open in a new window.  , FishBurn Systems provides some sort of CKSDev lite for VS.NET 2012/SharePoint 2013. Very useful.
http://visualstudiogallery.msdn.microsoft.com/6ed4c78f-a23e-49ad-b5fd-369af0c2107f This link is external to TechNet Wiki. It will open in a new window.  , web extensions make creating CSS in VS.NET a lot easier and supports CSS generation for multiple platforms.
http://technet.microsoft.com/en-us/library/cc508851 This link is external to TechNet Wiki. It will open in a new window. , the SharePoint 2010 Administration Toolkit (works on 2013).
http://clumsyleaf.com/products/cloudxplorer This link is external to TechNet Wiki. It will open in a new window.  , a great tool when you've installed your SharePoint farm on Azure.

Feature upgrade incomplete for Feature 'PublishingWeb' (Id: '94c94ca6-b32f-4da9-a9e3-1f3d343d7ecb') in Web. Exception: A duplicate content type name "Resource" was found.

When the SharePoint Server Publishing Infrastructure is activated it creates this hidden list automatically. 

This list is hidden and can be accessed by going to this URL: http://portalsite/relationships%20list/allitems.aspx. What happens here since the SharePoint Server Publishing Infrastructure feature is already activated in the SP2007 environment and then moved over to SP2010 via DB attachment there is a conflict with a column in that list called GroupGuid.

In SharePoint 2007 the column name is GroupId and is type text, and is changed in SharePoint 2010 to GroupGuid with the same type text. For whatever reason this column type is not updated when migrated over. This column type needs to be set at GUID not text. Since there is no way within SharePoint to create a column with a GUID type the best way to fix the problem is to delete this list and have it automatically re-created. 

To successfully delete this list follow these steps.
1. Go to Site Actions, Site Settings and Site Collection features under Site Collection Administration.
2. Deactivate the SharePoint Server Publishing Infrastructure feature
3. Go back to http://portalsite/relationships%20list/allitems.aspx
4. Go to List, List Settings and Delete this list (If the SharePoint Server Publishing Infrastructure feature is not deactivated this option will not be visible)
5. After deleting the list go back to Site Actions, Site Settings, and Site Collection features
6. Activate SharePoint Server Publishing Infrastructure feature

Column Limit Exceeded

There are too many columns of the specified data type. Please delete some other columns first. Note that some column types like numbers and currency use the same data type.
when trying to reactivate this feature read this blog posting -
7. The SharePoint Server Publishing Infrastructure feature will automatically recreate the list.
Go back to http://portalsite/relationship%20list/allitems.aspx and verify that the column GroupGuid now has a column of type GUID instead of text.
            Now go back to the site you were trying to access and you should no longer get that error message                   “One or more field types are not installed properly. Go to List settings page to delete these                   fields

Poweshell - Get the list of all template files or layout pages

Not interested in writing big story for small things  :)

List all the template files for given content SharePoint content database -

stsadm.exe -o enumallwebs -databasename <contentdbname>  > c:\template.txt

=====================================
List all page layouts -

$web = get-spweb http://yoursite
$pubWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web)
$pubWeb.GetAvailablePageLayouts() | select Name

List of all master pages for all web apps

Method 1
Get-SPWebApplication | Get-SPSite -Limit All | Get-SPWeb -Limit All | Select Title, URL, MasterUrl | Export-CSV C:\allmasterpage.csv

Method 2
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
#Get All site collections
$SiteCollections = Get-SPWebApplication | Get-SPSite -Limit All
#Loop through all site collections
   foreach($Site in $SiteCollections)
    {
        #Loop throuh all Sub Sites
       foreach($Web in $Site.AllWebs)
       {
      $MasterPage = $Web.GetFile($Web.MasterUrl);
          $MasterPage.Name  +" : " +$Web.Url
       }
    }