-->
Showing posts with label powershell. Show all posts
Showing posts with label powershell. Show all posts

Thursday, 28 November 2013

SharePoint Crawls - Full, Incremental, Continuous


Full Crawl

Full Crawl of Content source will re index all the content from beginning

Important Points to Consider:
  • If new managed property has been introduced, we need to run Full Crawl of content source     
  • If new crawl rules are created/updated/deleted, Full crawl of content source is required
  • If incremental crawl has been failed
  • If software update or service pack has been installed on the servers
  • Expensive in terms of performance issues


Incremental Crawl

Incremental Crawl of Content source will only process those items which are changed since the last crawl happened.

Important Points to Consider:
  • Most preferred after the full crawl has been done.
  • Does not hamper the performance as it will crawl only modified documents not the entire content source.
  • The incremental crawl will retry items and postpone crawling the item if the error persists.


A limitation with the Full Crawl and Incremental Crawl is we cannot schedule both to execute parallel. For example if the Full Crawl is already running then the Incremental Crawl cannot be triggered until the Full Crawl completes, if you try to Stop Full Crawl then also it is mandatory to finish at least once successful Full crawl before triggering any Incremental Crawls.

So Microsoft has come up with the concept of Continuous Crawl

Continuous Crawl

With Continuous Crawl you can maintain the content index as fresh as possible.               
    More than one continuous crawl can run in parallel
    one deep change will not result in degraded freshness on all following changes

The impact of a "Continuous Crawl" is the same as an incremental crawl.

At the parallel execution of crawls, the "Continuous Crawl" within the parameters defined in the "Crawler Impact Rule" which controls the maximum number of requests that can be executed by the server (default 8).

Sideloading of apps is not enabled on this site

I created my first SharePoint 2013 App and tried to deploy it in my SharePoint Farm and it shoot me the below error right into visual studio.



This Error comes up when you try to deploy app to site which is not a developer site. If you create a developer site and deploy the same app, it will work just fine.

But you can just go ahead using the same site by enabling the “Developer Site” feature on your current site collection

Execute the following PowerShell command on SharePoint PowerShell



Enable-SPFeature -Identity e374875e-06b6-11e0-b0fa-57f5dfd72085 -url <siteurl>


Happy SharePointing !

The SharePoint Server Publishing Infrastructure feature must be activated at the site collection level before the Publishing feature can be activated.

While creating a new search site in my site collection I got this error!


You might get this error while creating Business Intelligence Center site

Resolution:

Activate publishing at the site collection level


1.       From the root of your site collection, click Settings Small Settings gear that took the place of Site Settings. > Site settings.
2.       On the Site Settings page under Site Collection Administration, click Site collection features.
3.       On the Site Features page, scroll down to SharePoint Server Publishing Infrastructure and click Activate.

Once publishing features are activated, sub sites inherit them automatically. But, if you built a site before activating the publishing infrastructure, you’ll have to manually activate it for each site.


Activate publishing at the site level


1.       From any page within the site, click (gear icon) Settings Small Settings gear that took the place of Site Settings. > Site settings.
2.       On the Site Settings page, in the Site Actions section, click Manage site features.
3.       On the Site Features page, next to SharePoint Server Publishing, click Activate.


Using Powershell


Execute the below command in SharePoint Management Shell

Enable-SPFeature -Identity PublishingSite -Url http://sp2013labapp01/

Enable-SPFeature -Identity PublishingWeb -URL http://sp2013labapp01/



Happy Sharepointing !

Monday, 2 September 2013

Controlling growth using quotas

Can we control the amount of content that can be stored within a Site Collection so that it doesn’t grow beyond acceptable boundaries?
Yes, Using Quotas

What is it?
A quota specifies storage limit values for the maximum amount of data that can be stored in a site collection. Quotas also specify the storage size that, when reached, triggers an e-mail alert to the site collection administrator. Quota templates apply these settings to any site collection in a SharePoint farm.

Resource Points
Resource points correspond to specific levels of resource usage that you can define for up to 15 system resources that you want to monitor. Each of these resource measures accumulates points based on a single sandboxed solution's use of that resource, and those points are aggregated toward a quota that has been set for the whole site collection
When sandboxed code executes, certain metrics are collected such as % processor time and # of unhandled exceptions.  Timer jobs compile the metrics and calculate resource points usage.  When the total resource points used exceeds the daily limit (300 points by default), the sandbox is turned off for the entire site collection.  The following table describes the metrics collected and how they are normalized to resource points: 
Resource
Description
Units
Resources per Point
Limit
AbnormalProcessTerminationCount
Abnormally terminated process
count
1
1
CPUExecutionTime
CPU Execution Time for site
seconds
3,600
60
CriticalExceptionCount
Critical Exception Events
Events
10
3
InvocationCount
Solution Invocation Events
Events
<TBD>
<TBD>
PercentProcessorTime
% CPU usage by solution
%
85
100
ProcessCPUCycles
Solution CPU cycles
cycles
1 x10^11
1 x10^11
ProcessHandleCount
Windows handles count
items
10,000
1,000
ProcessIOBytes
Windows handles count
items
0
1 x10^8
ProcessThreadCount
Thread count in overall process
Thread instances
10,000
200
ProcessVirtualBytes
Memory consumed
Bytes
0
1.0x10^9
SharePointDatabaseQueryCount
Number of SharePoint database queries
Query instances
20
100
SharePointDatabaseQueryTime
Elapsed time to execute query
seconds
120
60
UnhandledExceptionCount
Number of unhandled exceptions
Unhandled exception instances
50
3
UnresponsiveProcessCount
Number of unresponsive processes
Unresponsive process instances
2
1

For example, if you developed a sandboxed web part that displayed data from a list, it would perform a SharePoint database query each time it loads.  20 database queries = 1 resource point, so if the web part was displayed 20 times, the site collection would have used 1 resource point.  The default site collection maximum is 300 points, so the web part could be displayed 6,000 times in a 24 hour period; after that, the sandbox is turned off until a timer job resets it.  It's important to understand is that resource quotas can be exceeded through high usage and is not necessarily an indicator of poorly written code.

About planning quota management

The basic steps to plan quota management are the following:
  1. Determine quota template settings
    There is no default quota template for site collections in a SharePoint Server 2010 environment
  1. Determine recycle bin settings
    The recycle bin can help to prevent the permanent deletion of content. The recycle bin enables site owners to retrieve items that users have deleted, without requiring administrator intervention such as restoring files from backup tapes. Key planning considerations include whether to use the second-stage recycle bin and how much space to allocate.
    The recycle bin is turned on and off at the Web application level. By default, the recycle bin is turned on in all the site collections in a Web application.
  2. Delete unused Web sites
    You can delete a quota template if you change your quota structures. However deleting a quota template does not delete quota values from site collections to which a quota template has been applied. If you want to remove quotas from all site collections that use a specific quota template, you must use the object model or perform a SQL Server query.

Key Notes about Quota Management

  1. Quotas are only applied to Site Collections
  2. You can create a default quota template at the web application level, which will be used by new site collections created moving forward.
  3. Everything in a site encompasses the Quota space: files in document libraries, items in your lists, all web parts, all images, form templates, etc…

Create Quota using Powershell

Get-SPWebTemplate | Out-File C:\SharepointWebTemplates.txt

Retreive the Current Quota settings for the site collection
(Get-SPSite -Identity "<Site Collection>").Quota
Where:
  • <SiteCollection> is the URL of the site collection
Create New Quota Template
       $quota = New-Object Microsoft.SharePoint.Administration.SPQuotaTemplate
        $quota.Name = “Dhaval”
        $quota.StorageMaximumLevel = ((10 * 1024) * 1024)
        $quota.StorageWarningLevel = ((8 * 1024) * 1024)
        $quota.UserCodeMaximumLevel = 100
        $quota.UserCodeWarningLevel = 80

        $service = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
        $service.QuotaTemplates.Add($quota)

        $service.Update()

Delete Quota Template
$service =[Microsoft.SharePoint.Administration.SPWebService]::ContentService
                                $service.QuotaTemplates.Delete($QuotaTemplateName)
        $service.Update()

Configure Quota and Locks


Option 
Option Description
Unlock Not locked
NoAdditions
Unlocks the site collection and makes it available to users.
ReadOnly Adding content prevented
NoAccess
Prevents users from adding new content to the site collection. Updates and deletions are still allowed.


To lock or unlock a site collection by using Windows PowerShell
Set-SPSite -Identity "<SiteCollection>" -LockState "<State>" –QuotaTemplate “<Quota Template>”

Where:
  • <SiteCollection> is the URL of the site collection that you want to lock or unlock.
  • <Quota Template> is the name of the quota template
  • <State> is one of the following values:
    • Unlock to unlock the site collection and make it available to users.
    • NoAdditions to prevent users from adding new content to the site collection. Updates and deletions are still allowed.
    • ReadOnly to prevent users from adding, updating, or deleting content.
    • NoAccess to prevent users from accessing the site collection and its content. Users who attempt to access the site receive an error.

References: