Thursday, November 20, 2014

Migrate content into or out of RBS (SharePoint Foundation 2010)

This article describes how to migrate content into or out of Remote BLOB Storage (RBS), or to a different RBS provider.
After installing RBS and setting a content database to use RBS, all existing content in that database can be migrated into the database's active provider. You use the same Windows PowerShell 2.0 command to migrate content into or out of RBS, or to another RBS provider. When RBS is implemented, SQL Server itself is regarded as an RBS provider.
You can migrate content databases at any time, but we recommend that you perform migrations during low usage periods so that this activity does not cause performance degradation for users. Migration moves all content from the specified content database into the storage mechanism of the newly named provider.
This operation can be performed on any Web server in the farm. You only need to perform the operation one time on one Web server for each content database that you want to migrate.
To migrate a content database by using Windows PowerShell
  1. Verify that you meet the following minimum requirements: See Add-SPShellAdmin.
  2. On the Start menu, click All Programs.
  3. Click Microsoft SharePoint 2010 Products.
  4. Click SharePoint 2010 Management Shell.
  5. At the Windows PowerShell command prompt, type the commands in the following steps.
  6. To obtain the content database RBS settings object:
    $cdb=Get-SPContentDatabase <ContentDbName>
    $rbs=$cdb.RemoteBlobStorageSettings
    
    Where <ContentDbName> is the name of the content database.
  7. To view a list of all RBS providers that are installed on the Web server:
    $rbs.GetProviderNames()
    
  8. To set the active RBS provider:
    $rbs.SetActiveProviderName(<NewProvider>)
    
    Where <NewProvider> is the name of the provider that you want to make active for this content database. If you want to migrate the content database out of RBS altogether and back into SQL Server inline storage, set this value to ().
  9. Migrate the data from RBS to the new provider or to SQL Server:
    $rbs.Migrate()

Configuring remote blob storage with SharePoint 2010

I have taken this article from the below URL
 
With Sharepoint 2010, the Remote Blob Storage (RBS) functionality, which allows putting documents into the database filesystem instead of the database itself, came into focus again. To make that happen each content database is located in a specific section of the file system where all the documents are stored. This documents are none the less managed by Sharepoint, a database is mandatory even if the documents are stored as BLOB because metadata is written exclusively into databases.
The following installation routines and steps to activate RBS are based on Technet and the blogs of Jie Li and ToddKlindts.
All the following installations have been done on Microsoft Windows Server 2008 R2 and Microsoft SQL Server 2008 R2 as there is no support for RBS on Microsoft SQL Server 2005.
First of all we have to activate FILESTREAM on the SQL instance that you want to put to the BLOB. 
  1. Connect to SQL Server 
    Start –> All Programs –> Microsoft SQL Server 2008 R2 –> Configuration Tools –> SQL Server Configurations Manager
  2. In the Services list, click “SQL Server Services
  3. Choose your SQL instance (here “SQL Server (MSSQLSERVER)”) and right click Properties.
  4. Switch to the FILESTREAM tab and check all the available checkboxes
  5. Click Apply –> OK 
    clip_image002
  6. Now start SQL Server Management Studio 
    Start –> All Programs –> Microsoft SQL Server 2008 R2 –>SQL Server Management Studio
  7. Open a query windows and start the following SQL statement clip_image004 
    For easier reference, just copy the text below
    EXEC sp_configure filestream_access_level, 2 

    RECONFIGURE 

This was the first step, FILESTREAM is now successfully activated.
All further steps requires SharePoint to be installed properly and that a WebApplication has already been created. The Content Database in this case I created by Powershell: 
  1. Connect to a Front End Server Start –> Microsoft SharePoint 2010 Products –> SharePoint 2010 Management Shell Create a Content Database clip_image006 
    For easier reference, just copy the text below
    New-SPContentDatabase –name WSS_Content_Blob_001 –WebApplication 
    http://sp2010 –MaxSiteCount 1 –WarningSiteCount 0
Now the new content database (in this case “WSS_Content_Blob_001”) has to be prepared for use with FILESTREAM.
  1. Connect to your SQL Server 
    Start –> All Programs –> Microsoft SQL Server 2008 R2 –>SQL Server Management Studio
Open a query and execute the statement below. Replace “C:\Blobstore“ by your storage-path. The directory must not exist when executing the statement, otherwise an error will be given. clip_image008 For easier reference, just copy the text below 



use [WSS_Content_Blob_001]

 

if not exists (select * from sys.symmetric_keys where name = N'##MS_DatabaseMasterKey##')create master key encryption by password = N'Admin Key Password !2#4'








 

 
use [WSS_Content_Blob_001] 
if not exists (select groupname from sysfilegroups where groupname=N'RBSFilestreamProvider')alter database [WSS_Content_Blob_001]  add filegroup RBSFilestreamProvider contains filestream



use [WSS_Content_Blob_001] 
alter database [WSS_Content_Blob_001] add file (name = RBSFilestreamFile, filename = 'c:\Blob_001') to filegroup RBSFilestreamProvider



Now the direcory for the Blobstore has been created in “C:\Blob_001
Next you have to download the EXE for RBS, and it has to be copied to each Web Frontend Server. During all the following steps mind checking the log files for errors. 
  1. Connect to the Web Front End hosting the Central Admin Console
  2. Open a Command Prompt (IMPORTANT -> run with elevated permissions) 
    clip_image010
  3. Change to the directory containing the previously downloaded RBS_X64.exe
  4. Delete or rename a already existing „rbs_install_log.txt“ if applicable.
  5. Run the follwoing command, replace DBNAME with your content database and DBINSTANCE with your SQL instance. Mind that this command only works once, if you want to configure a second database, chose the option “Configure additional database” (see below).
    msiexec /qn /lvx* rbs_install_log.txt /i RBS_X64.msi TRUSTSERVERCERTIFICATE=true FILEGROUP=PRIMARY DBNAME="WSS_Content_Blob_001" DBINSTANCE="DC" FILESTREAMFILEGROUP=RBSFilestreamProvider FILESTREAMSTORENAME=FilestreamProvider_1
  6. After this process has completed (it may take a minute or two, the log reads “Verbose Logging stopped”), check the “rbs_install_log.txt” if it contains the following line of text (it should be approximately 21 lines before the end of the file: 

    "Product: SQL Remote Blob Storage -- Configuration completed successfully" 

    If that is not the case you have an issue. Check the following: 
    - Are you in the right directory 
    - Did you make a typo 
    - Did you run the prompt with elevated privileges
  7. If you have more than one WFE in your farm, you now have to change to the other servers and run the following command: clip_image012 
    For easier reference, just copy the text below 

    msiexec /qn /lvx* rbs_install_log.txt /i RBS_X64.msi DBNAME="WSS_Content_Blob_001" DBINSTANCE="DC" ADDLOCAL="Client,Docs,Maintainer, ,FilestreamClient,FilestreamServer" 

  8. Check the “rbs_install_log.txt” if it contains the following line of text (it should be approximately 21 lines before the end of the file: 

    "Product: SQL Remote Blob Storage -- Configuration completed successfully" 

  9. Execute all steps from step 7 on every additional WFE. This is mandatory, otherwise problems might occur.
The script has created a few tables in the database, check if they are existing: 
  1. Connect to SQL Server 
    Start –> All Programs –> Microsoft SQL Server 2008 R2 –>SQL Server Management Studio
  2. Execute the following query clip_image014 
    For easier reference, just copy the text below 

    use WSS_Content_Blob_001 

    select * from dbo.sysobjects 
    where name like ‘rbs%’
     

The result should show the RBS tables. This may take a while.
As one last step you have to tell Sharepoint that the content database uses RBS. To do that you have to execute the following command: 
  1. Connect to WFE 
    Start –> Microsoft SharePoint 2010 Products –> SharePoint 2010 Management Shell
  2. Execute the following commands in sequence: clip_image016
    For easier reference, just copy the text below 

    $cdb = Get-SPContentDatabase WSS_Content_Blob_001 

    $rbss = $cdb.RemoteBlobStorageSettings


    $rbss.Installed()


    $rbss.Enable() 

    $rbss.SetActiveProviderName($rbss.GetProviderNames()[0]) 

    $rbss
     
Since all has been prepared we can check the functionality. Just create a site collection and make sure the content database used is “WSS_Content_Blob_001”. (or whatever you chose during install). 
  1. Connect to WFE 
    Start –> Microsoft SharePoint 2010 Products –> SharePoint 2010 Central Administration
  2. Application Management – Manage Content Databases
  3. Choose the applicable Web Application
  4. Configure the Content Database to put the next site collection to “WSS_Content_Blob_001” 
    – If you have multiple databases, set “Maximum Number of Site Collections” to the current value 
    – “WSS_Content_Blob_001” should not contain any site collections
  5. Go back to the main site of  Central Administration
  6. Application Management – Create Site Collection 
    - Enter all the required data 
    - OK
  7. As soon as the site collection creation is finished, all newly uploaded documents should be created in the filesystem.

Notice:

Documents below 100 kB will not be put to the file system but will be stored in the database.

Configure additional content databases:

If you want to configure more than one content database for RBS, all the steps above have to be executed. The only difference is the command in step 5. This one dies not work, and no RBS tables are created. Therefore use the command below:



 
msiexec /qn /i rbs.msi REMOTEBLOBENABLE=1 FILESTREAMPROVIDERENABLE=1 DBNAME=WSS_Content_Blob_002 FILESTREAMSTORENAME=FilestreamProvider_1 ADDLOCAL=EnableRBS,FilestreamRunScript DBINSTANCE=CD 

Friday, November 14, 2014

SharePoint 2013 Server Installation step by step

Install and Configure SharePoint Server 2013 step by step

In this blog post I am covering all basic required steps of SharePoint 13 installation. And have divided this in 4 parts.
1) Install Windows Server 2012 and Active Directory configuration.
2) Install SQL Server 2012.
3) Install and configure SharePoint Server 2013 .
4) Configure SharePoint Server Service Applications
5) Create your first web application on SharePoint Server 2013.
Installation and configuration of Windows Server and SQL server have done more specific to build SharePoint Server farm prospective.
For example, Permissions given to Service accounts during installation of windows server. Installation of SQL server and SharePoint Server have done by specific service account.

Original Blog (Please use the below URL for step by step)

http://blog.anuragg.com/2012/12/install-and-configure-sharepoint-server_25.html

Thursday, October 30, 2014

Check the size of SharePoint 2010 sites using PowerShell

Execute the below code under Powershell command prompt. Once you have run the script, you can call it with the following PowerShell command:

GetWebSizes -StartWeb <StartURL>




if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null)
{
    Add-PSSnapin "Microsoft.SharePoint.PowerShell"
}
function GetWebSizes ($StartWeb)
{
    $web = Get-SPWeb $StartWeb
    [long]$total = 0
    $total += GetWebSize -Web $web
    $total += GetSubWebSizes -Web $web
    $totalInMb = ($total/1024)/1024
    $totalInMb = "{0:N2}" -f $totalInMb
    $totalInGb = (($total/1024)/1024)/1024
    $totalInGb = "{0:N2}" -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()
}
function GetWebSize ($Web)
{
    [long]$subtotal = 0
    foreach ($folder in $Web.Folders)
    {
        $subtotal += GetFolderSize -Folder $folder
    }
    write-host "Site" $Web.Title "is" $subtotal "KB"
    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
        }
        write-host "Site" $subweb.Title "is" $webtotal "Bytes"
        $subtotal += $webtotal
        $subtotal += GetSubWebSizes -Web $subweb
    }
    return $subtotal
}
function GetFolderSize ($Folder)
{
    [long]$folderSize = 0 
    foreach ($file in $Folder.Files)
    {
        $folderSize += $file.Length;
    }
    foreach ($fd in $Folder.SubFolders)
    {
        $folderSize += GetFolderSize -Folder $fd
    }
    return $folderSize
}

Wednesday, September 10, 2014

How to detect the edition of SharePoint 2010 installed?

See the article How To: Detect the Installed SKU of SharePoint 2010 on MSDN. It has a list of GUIDs for each SKU:
  • BEED1F75-C398-4447-AEF1-E66E1F0DF91E: SharePoint Foundation 2010
  • 1328E89E-7EC8-4F7E-809E-7E945796E511: Search Server Express 2010
  • B2C0B444-3914-4ACB-A0B8-7CF50A8F7AA0: SharePoint Server 2010 Standard Trial
  • 3FDFBCC8-B3E4-4482-91FA-122C6432805C: SharePoint Server 2010 Standard
  • 88BED06D-8C6B-4E62-AB01-546D6005FE97: SharePoint Server 2010 Enterprise Trial
  • D5595F62-449B-4061-B0B2-0CBAD410BB51: SharePoint Server 2010 Enterprise
  • BC4C1C97-9013-4033-A0DD-9DC9E6D6C887: Search Server 2010 Trial
  • 08460AA2-A176-442C-BDCA-26928704D80B: Search Server 2010
  • 84902853-59F6-4B20-BC7C-DE4F419FEFAD: Project Server 2010 Trial
  • ED21638F-97FF-4A65-AD9B-6889B93065E2: Project Server 2010
  • 926E4E17-087B-47D1-8BD7-91A394BC6196: Office Web Companions 2010
You can look for these within the registry key HKLM\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0\WSS\InstalledProducts.
You can also use the PowerShell command get-spfarm | select Products to output GUIDs for the installed SKUs.

Friday, April 11, 2014

Save Wiki Library as a Template in Sharepoint 2010

When going into Library Settings on a Wiki Library Template, I noticed the “Save Library as Template” option was missing.

Found a workaround by changing the URL in this way:
Change the “listedit.aspx” filename in the URL to “savetmpl.aspx” instead…

Friday, April 4, 2014

Make attachment required field in SharePoint List/ Library

<script type="text/javascript" language="javascript">
function PreSaveAction()
{
  var elm = document.getElementById("idAttachmentsTable");
    if (elm == null || elm.rows.length == 0)
 {
       document.getElementById("idAttachmentsRow").style.display='none';
  alert("Please Attach File");
  return false ;

 }
 else {
 return true ;
 }
 return true ;
}
</script>
--------------------------------------------
If need confirmation box. Please use the below code

function PreSaveAction()
{
      var elm = document.getElementById("idAttachmentsTable");
               if (elm == null || elm.rows.length == 0)
            {
var r=confirm("Do you want to attach the file?");
if(r==true)
        {
return false;
}
  else
{
return true;

}

                }
      else
{
return true;
}

     return true ;
}