Tuesday, December 13, 2016

How to Start and Stop the Distributed Cache service

To start and stop the Distributed Cache service by using Central Administration

1. In Central Administration, click Application Management.
2. In Service Applications, click Manage Services on Server.
3. On the Services on Server page, locate the Distributed Cache service.
4. If the Distributed Cache service is started and you want to stop the service, under Action, click Stop. If the Distributed Cache service is stopped and you want to start the service, under Action, click Start.

To start the Distributed Cache service by using SharePoint 2013 Management Shell


At the SharePoint Management Shell command prompt, run the following command:

1. $instanceName ="SPDistributedCacheService Name=AppFabricCachingService"
2. $serviceInstance = Get-SPServiceInstance | ? {($_.service.tostring()) -eq $instanceName -and ($_.server.name) -eq $env:computername}
3. $serviceInstance.Provision()

SharePoint Distributed Cache

SharePoint 2013 introduces a new concept called Distributed Cache. The Distributed Cache service, which is built on Windows Server AppFabric Cache, is set to run in a collocated mode on all SharePoint 2013 Servers by default, using up to 10% of the server's total physical memory. It’s essential for maintaining the large amounts of information on your SharePoint Server, ensuring that the information is fresh and readily available for the end user.

The Distributed Cache service provides caching functionality to features (not to be
confused with site features) in SharePoint Server 2013. The Distributed Cache service is either required by or improves performance of the following features:
  • Authentication
  • Newsfeeds
  • OneNote client access
  • Security Trimming
  • Page load performance
Caching functionalities, provided by the Distributed Cache service, enable the SharePoint features listed above to quickly retrieve data without any dependency on databases stored in SQL Server, as everything is stored in memory.

Related Topic : Start and Stop the Distributed Cache service

Friday, December 2, 2016

How to find the Workflow Service URL for a SharePoint 2013 Farm using Powershell

To find the registered workflow service address for a SharePoint 2013 farm :

Add-PSSnapin Microsoft.SharePoint.PowerShell
[Void][System.Reflection.Assembly]::loadwithpartialname("Microsoft.SharePoint.WorkflowServicesBase")
$web = Get-SPSite -Limit 1 -WarningAction SilentlyContinue | Get-SPWeb
$wfm = New-Object Microsoft.SharePoint.WorkflowServices.WorkflowServicesManager($web)
$wfm | SELECT *

The above powershell commands returns the below value :

https://abc.xyz.com:12290/SharePoint/

The /SharePoint/ segment of the URL is added by SharePoint during registration process, you should not add segment to your registration URL.

Thursday, December 1, 2016

How to create a SharePoint Subscription Settings Service application through PowerShell

This example assumes that a managed account for DOMAIN\ManagedAccount already exists. 

$AppPool = New-SPServiceApplicationPool -Name SettingsServiceAppPool -Account (Get-SPManagedAccount DOMAIN\ManagedAccount)

$App = New-SPSubscriptionSettingsServiceApplication -ApplicationPool $appPool -Name SettingsServiceApp -DatabaseName SettingsServiceDB

$proxy = New-SPSubscriptionSettingsServiceApplicationProxy -ServiceApplication $App

Get-SPServiceInstance | where{$_.TypeName -eq "Microsoft SharePoint Foundation Subscription Settings Service"} | Start-SPServiceInstance

This example creates
- an application pool
- a new subscription settings service application
- a subscription settings service application proxy

- and starts the service instance on the local machine. 

Wednesday, November 23, 2016

How to retrieve a List of Application Pools in a Server

From the UI

1. Open IIS Manager. For information about opening IIS Manager, see Open IIS Manager (IIS 7).

2. In the Connections pane, click Application Pools in the tree.

From Command Line

1. Open command prompt.

2. Type "cd C:\Windows\System32\inetsrv" [Appcmd.exe exists at the location %systemroot%\system32\inetsrv\]

3. Type "appcmd list apppool"

Thursday, September 22, 2016

How to Force Log In To Remote Desktop Computer When The Session is Already Full

Use the below command in Run

mstsc /v:[SERVERNAME] /admin

That should force you into the server if the session is full.


No content databases in the web application were available to store your site collection

Recently I had tried deleting a site collection and tried restoring the site with the same URL and I got the below error

Restore-SPSite https://sitecollectionurl -Path "E:\filename.bak" -Force

“ Restore-SpSite : The operation that you are attempting to perform cannot be completed successfully. No content databases in the web application were available to store your site collection. The existing content databases may have reached the maximum number of site collections, or be set to read-only, or be offline, or may already contain a copy of this site collection. Create another content database for the Web application and then try the operation again “


How to fix this

Restore-SPSite https://sitecollectionurl -Path "E:\filename.bak" -Force –DatabaseServer "DBServerName" -DatabaseName "DBName"

And it worked this time. Site was successfully restored.
This happened because I was trying to restore or create a new site with the same url that was deleted some time back. There is a chance it has not been removed from the database permanently

Alternatively, to delete the old site, do the below steps

Get-SPDeletedSite

If the site exist with the same URL remove using

Remove-SPDeletedSite -Identity

Tuesday, August 9, 2016

How to Add/Modify your Hosts file

1. Go to  Start -> All Programs -> Accessories -> Notepad

2. Type Notepad in the search field, Right-click Notepad and select Run as administrator.

3. From Notepad, open the following file: C:\Windows\System32\Drivers\etc\hosts

4. Make the required entries to the file.

5. Click File -> Save to save your changes.

Tuesday, June 28, 2016

How to add a user to Web Application User Policy using PowerShell

To add a user to web application user policy using PowerShell , use the below PowerShell script

$userOrGroup = "i:0#.w|domain\user"
$displayName = "User-NTLM"

$webApp = Get-SPWebApplication("URL")
$policy = $webApp.Policies.Add($userOrGroup, $displayName)
$policyRole = $webApp.PolicyRoles.GetSpecialRole([Microsoft.SharePoint.Administration.SPPolicyRoleType]::FullControl)
$policy.PolicyRoleBindings.Add($policyRole)
$webApp.Update() 

Thursday, June 23, 2016

You need to be a site collection administrator to set this property.

Issue Description

Recently I was trying to add a site collection administrator to a site and I got the belowmessage

You need to be a site collection administrator to set this property.   at Microsoft.SharePoint.ApplicationPages.ManageSiteAdminPage.BtnSubmit_Click(Object sender, EventArgs e)
   at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
   at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
   at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)




I was already the site collection administrator to the site and it did not make any sense.

Fix

On further trouble shooting, I found the solution for this.Browse to Central Administration - > Site Collection Quotas and Locks.

The options available here are:

       Not locked
Adding content prevented
Read-only (blocks additions, updates, and deletions)
No access

This site collection was in Read-only status. Unlock it (Change the status to  "Not Locked")



Tuesday, March 29, 2016

SharePoint 2013 Designer Workflow is not started and the initiator is Anonymous

Issue Description

Workflow created using SharePoint designer is not getting started and the initiator is Anonymous.
Recently I ran across an issue where a SharePoint Designer workflow associated with a list was showing the below symptoms. It was a simple list and a basic workflow sending an email. 
The status of the workflow showed :

Initiator : Anonymous and Internal Status : Not started

Screenshot below




How to fix this

1. Make sure that the below services are in Running state

Workflow Manager Backend
Service Bus Message Broker
Service Bus Gateway

Windows Fabric Host Service (FabricHostSvc)




2. Restart the WorkflowServiceBackend service

net stop WorkflowServiceBackend
net start WorkflowServiceBackend

Wednesday, March 23, 2016

Restore-SPSite : 0x80070003

Issue Description

I was trying to do a backup and restore operation between SharePoint farms and got the below error message:

Restore-SPSite : <nativehr>0x80070003</nativehr><nativestack></nativestack>

Resolution

            Make sure that the source and target SharePoint farms are in the same SharePoint build versions.

Monday, March 14, 2016

SharePoint 2013 Query Suggestions

Query suggestions are phrases that you want the search system to suggest to users as they start typing a query. For example, as you start to type "Chicago", they may be able to pick  a word that starts with "Chicago" from a list below the Search Box.

The Query Suggestion feature needs to be enabled at the Service Application level to be activated.Once this is done there are 2 ways to implement query suggestion.

1. Manually upload the query suggestion list into SharePoint.

2. The search system automatically creates suggestions for a query when users have clicked one or more of the results for that query at least six times.

Manually uploading the query suggestion

1. Browse to Central Administration -> Service Applications -> Search Service Application.

2. Go to Queries and Results -> Query Suggestions


3. Select Show Query Suggestions

4. In Always suggest phrases -> Import from text file


5. Browse to Central Administration -> Monitoring -> Review job definitions -> Prepare query suggestions -> Run Now

6. In this example, I start typing for the word “Chicago, all words starting with Chicago is automatically picked up.



Implementing Thesaurus in SharePoint 2013

1. Create a thesaurus file
2. Deploy/Import the Thesaurus file
3. Check the results

1. Create a thesaurus file

- In the Key column, enter the term (single or multiple words) that you want to trigger a synonym for when the term occurs in a query.
- In the Synonym column, enter the synonym (single or multiple words) that you want to add to the query if the term specified in the Key column occurs in a query.
- In the optional Language column, enter the abbreviation for the language for which the synonym should apply.
Example of a thesaurus looks like this:
 Key,Synonym,Language
IE,Internet Explorer
Internet Explorer,IE
UN,United Nations,en
UN,Vereinte Nationen,de

2. Deploy/Import the Thesaurus file

Start the SharePoint 2013 Management Shell.

$searchApp = Get-SPEnterpriseSearchServiceApplication
Import-SPEnterpriseSearchThesaurus -SearchApplication $searchApp -Filename <Path>

<Path> specifies the full UNC path of the .csv file (the thesaurus) to be imported.Universal Naming Convention (UNC) is a way to identify a shared file in a computer without having to specify (or know) the storage device it is on. 

In Windows operating systems, the UNC name format is:

3. Check the results

When you search for "IE" you should get results with "IE" and "Internet Explorer"

SharePoint 2013 Thesaurus or Synonyms

SharePoint 2013 Thesaurus or Synonyms

The Thesaurus feature in SharePoint is associated with the SharePoint Search Service Application. In SharePoint Search if you want to include synonyms also in Search results for specific keywords, you need to import a thesaurus file into SharePoint.

In case you search for IE and you want the Search Results to include IE and Internet explorer, you need to have a thesaurus file uploaded with these entries into SharePoint

Thesaurus file is normally used to specify synonyms for a single word or multiple words that occur in queries. The query is expanded based on the entries in the thesaurus. You create and maintain the thesaurus file in a system external to SharePoint 2013 before you import it into SharePoint 2013 to make the synonyms available to the search system.
It should be a .csv file with the columns Key, Synonym and Language

- In the Key column, enter the term (single or multiple words) that you want to trigger a synonym for when the term occurs in a query.

- In the Synonym column, enter the synonym (single or multiple words) that you want to add to the query if the term specified in the Key column occurs in a query. Synonyms consisting of multiple words will be added as phrases to the query.

- In the optional Language column, enter the abbreviation for the language for which the synonym should apply.If you leave this column empty, the query is expanded with the synonym regardless of the query language.
Note : Make sure there are no leading or trailing spaces around the terms

Example of a thesaurus looks like this :

Key,Synonym,Language
IE,Internet Explorer
Internet Explorer,IE
UN,United Nations,en
Implementing Thesaurus in SharePoint 2013

Thursday, March 3, 2016

PowerShell to get the details of Content Sources in the SharePoint Search Service Application

This example retrieves the default content source for the search service application.

$ssa = Get-SPEnterpriseSearchServiceApplication

Get-SPEnterpriseSearchCrawlContentSource -SearchApplication $ssa


Name                           Id    Type                CrawlState CrawlCompleted     
----                               --      ----                   ---------- --------------     
Local SharePoint sites     1     SharePoint           Idle                          
Content Source 1           17    SharePoint           Idle       2/2/2016 2:58:46 PM
Content Source 2            6     SharePoint           Idle       2/2/2016 1:57:00 PM
Content Source 3            12   SharePoint           Idle       2/2/2016 11:57:40 AM
Content Source 4            14   SharePoint           Idle       2/2/2016 11:58:14 AM
Content Source 5            15   SharePoint           Idle       2/2/2016 3:27:58 PM



Wednesday, February 17, 2016

Configure Workflow Manager on a server that is NOT part of the SharePoint 2013 farm

Note: For configuring Workflow Manager on a server that is NOT part of the SharePoint 2013 farm, you must install the Workflow Manager Client on each server in the SharePoint farm before you run the pairing cmdlet.


For downloading and installing the Workflow Manager Client go here

To configure Workflow Manager on a server that is NOT part of the SharePoint 2013 farm and on which communication takes place by using HTTP

1. Log on to each server in the SharePoint Server 2013 farm.

2. Install the Workflow Manager Client on each server in the SharePoint farm.

3. Open the SharePoint Management Shell as an administrator. This is accomplished by right-clicking the SharePoint 2013 Management Shell command and choosing Run as administrator.

4. Run the Register-SPWorkflowService cmdlet. The cmdlet should be run only once and can be run from any of the servers in the SharePoint farm.

Register-SPWorkflowService -SPSite "http://myserver/mysitecollection" -WorkflowHostUri "http://workflow.example.com:12291" -AllowOAuthHttp


To configure Workflow Manager on a server that is NOT part of the SharePoint 2013 farm and on which communication takes place by using HTTPS

1. Determine whether you need to install Workflow Manager certificates in SharePoint 2013.

2. Log on to each server in the SharePoint Server 2013 farm.

3. Install the Workflow Manager Client on each server in the SharePoint farm.

4. Open the SharePoint Management Shell as an administrator. This is accomplished by right-clicking the SharePoint 2013 Management Shell command and choosing Run as administrator.

5. Run the Register-SPWorkflowService cmdlet.

Register-SPWorkflowService -SPSite "https://myserver/mysitecollection" -WorkflowHostUri "https://workflow.example.com:12290"






Configure Workflow Manager on a server that is part of the SharePoint 2013 farm

To configure Workflow Manager on a server that is part of the SharePoint 2013 farm and on which communication takes place by using HTTP

1. Log on to the computer in the SharePoint Server 2013 farm where Workflow Manager was installed.

2. Open the SharePoint Management Shell as an administrator. This is accomplished by right-clicking the SharePoint 2013 Management Shell and choosing Run as administrator.

3. Run the Register-SPWorkflowService cmdlet.

Register-SPWorkflowService -SPSite "http://myserver/mysitecollection" -WorkflowHostUri "http://workflow.example.com:12291" -AllowOAuthHttp

4. Log on to each server in the SharePoint Server 2013 farm. Each server in the SharePoint Server 2013 farm must have the Workflow Manager Client installed.

5. Install the Workflow Manager Client on each server in the SharePoint farm.



To configure Workflow Manager on a server that is part of the SharePoint 2013 farm and on which communication takes place by using HTTPS

1. Determine if you need to install Workflow Manager certificates in SharePoint.

2. Log into the computer in the SharePoint Server 2013 farm where Workflow Manager was installed.

3. Open the SharePoint Management Shell as an administrator. This is accomplished by right-clicking the SharePoint 2013 Management Shell and choosing Run as administrator.

4. Run the Register-SPWorkflowService cmdlet.

Register-SPWorkflowService -SPSite "https://myserver/mysitecollection" -WorkflowHostUri "https://workflow.example.com:12290"

5. Log on to each server in the SharePoint Server 2013 farm. Each server in the SharePoint Server 2013 farm must have the Workflow Manager Client installed.

6. Install the Workflow Manager Client on each server in the SharePoint farm.


For downloading and installing the Workflow Manager Client go here





Install and configure workflow for SharePoint Server 2013

1. Install and configure SharePoint Server 2013

2. Install and configure Workflow Manager

3. Configure Workflow Manager to work with the SharePoint Server 2013 farm

The following two key factors needs to be considered before configuring Workflow Manager to work with SharePoint Server 2013.

1. Is Workflow Manager installed on a server that is part of the SharePoint farm?
2. Will communication between Workflow Manager and SharePoint Server 2013 use HTTP or HTTPS?

These factors translate into four scenarios. Each scenario configures a SharePoint Server 2013 farm to communicate and function with the Workflow Manager farm.

1: Workflow Manager is installed on a server that is part of the SharePoint 2013 farm. Communication takes place by using HTTP.

2: Workflow Manager is installed on a server that is part of the SharePoint 2013 farm. Communication takes place by using HTTPS.

3: Workflow Manager is installed on a server that is NOT part of the SharePoint 2013 farm. Communication takes place by using HTTP.

4: Workflow Manager is installed on a server that is NOT part of the SharePoint 2013 farm. Communication takes place by using HTTPS.





Reference

SharePoint 2013 Crawl job will not stop

When you are unable to stop a crawl (full or incremental) using the Central Administration UI, you can try one of the below steps

Approach 1 (Restart Search services)

1. Stop and start the SharePoint Server Search 15 service
2. Go to services.msc -> SharePoint Server Search 15 -> Restart
Run the PowerShell script on the SharePoint server

Approach 2 (Using net start command)

net stop OSearch15
net start OSearch15

Approach 3 (Using PowerShell command)

Stop-Service -name OSearch15
Start-Service -name OSearch15

Approach 4 (PowerShell script to stop the SharePoint Crawl Job)

Add-PSSnapin "Microsoft.SharePoint.PowerShell"
Get-SPEnterpriseSearchCrawlContentSource -SearchApplication "Search Service Application" | ForEach-Object {
     if ($_.CrawlStatus -ne "Idle")
     {
         Write-Host "Stopping currently running crawl for content source $($_.Name)..."
         $_.StopCrawl()
       
         do { Start-Sleep -Seconds 1 }
         while ($_.CrawlStatus -ne "Idle")
     }
}

Approach 5 (Perform an Index rest)

Browse to Central Administration -> Search Service Application -> Crawling-> Index Reset -> Reset Now
Note: Resetting the crawled content will erase the content index. After a reset, search results will not be available until crawls have been run.

Friday, January 29, 2016

How to change the URL for SharePoint Central Administration site

If you extend the Central Administration web application (using GUI or psconfig command) to run on multiple servers, and when you click on SharePoint Central Administration icon you're still redirected to the first SharePoint server where Central Administration is hosted.

The URL has to be changed via registry on all SharePoint servers to fix this.

To change the URL for SharePoint Central Administration URL:

1) Open Registry editor

2) Backup the registry before making changes


3) Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0\WSS and change the value of CentralAdministrationURL to the new URL


Monday, January 18, 2016

Common Office Web Apps PowerShell commands

Get-SPWOPIBinding
The Get-SPWOPIBinding returns a list of bindings that were created by using New-SPWOPIBinding on the current SharePoint farm.

Get-SPWOPIBinding

Remove-SPWOPIBinding
The Remove-SPWOPIBinding removes all bindings on the current SharePoint farm.

Remove-SPWOPIBinding -All:$true

New-SPWOPIBinding
The New-SPWOPIBinding creates bindings for all the applications and file name extensions that the WOPI application supports on the current SharePoint farm

New-SPWOPIBinding -ServerName "Server.corp.Contoso.com"


Related Posts – 1 , 2