Wednesday, September 23, 2015

Excluding Sites from Search - SharePoint 2013

Instead of setting each subsites search visibility property manually, use Powershell to exlude SharePoint sites from search.

Content from that site and all of its subsites will not appear in search results.


$siteUrl = "http://NameOfSite"

Get-SPSite $siteUrl | Get-SPWeb -Limit all | ForEach-Object {
Write-Host “`tProcessing Web: $($_.ServerRelativeUrl)…” -ForegroundColor White
 if (!$whatIf)
 {
 Write-Host “Setting properties on Web:” $_.Title -ForegroundColor White
 $_.NoCrawl = $true
 #Update the web
 $_.Update()
 }
 else
 {
 Write-Host “Reading properties on Web:” $_.Title -ForegroundColor White
 Write-Host “No crawl enabled: “$_.NoCrawl
 }
 }
 $site.Dispose()

Start User Profile Synchronization Service using PowerShell

How to start User Profile Synchronization Service using PowerShell?


Open SharePoint Management Shell.

Get-SPServiceInstance | Where-Object {$_.TypeName -eq 'User Profile Synchronization Service'}

Using this powershell commandlet you can get GUID details.


Start-SPServiceInstance –Identity  GUID of the Service application


Sometimes your User Profile Synchronization service might stuck in “Starting” due to some issues in Synchronization. To Stop that service, use the below command

Stop-SPServiceInstance –Identity  GUID of the Service application

Wednesday, September 16, 2015

Add different Colors to Calendar Overlay

How to add different Colors to Calendar Overlay in SharePoint?


Edit page.














Add web part, Content Editor.














Edit Source.












Paste text


<style type="text/css">
.ms-acal-color1{
   background-color:#1BBA61;
}
.ms-acal-color2{
   background-color:#C0362C;
}
.ms-acal-color3{
   background-color:#816C5B;
}
.ms-acal-color4{
   background-color:#668D3C;
}
.ms-acal-color5{
   background-color:#007996;
}
.ms-acal-color6{
   background-color:#1BECDC;
}
.ms-acal-color7{
   background-color:#253529;
}
.ms-acal-color8{
   background-color:#288054;
}
.ms-acal-color9{
   background-color:#AEA9B8;
}
</style>


You can choose the color from http://www.color-hex.com/

Friday, September 11, 2015

Start and Stop the Distributed Cache Service PowerShell

How to start and stop Distributed Cache Service using SharePoint Management Shell?


# Start the Distributed Cache service by using Windows PowerShell     
     
$InstanceName = "SPDistributedCacheService Name=AppFabricCachingService";           
$serviceInstance = Get-SPServiceInstance | ? {($_.service.tostring()) -eq $instanceName -and ($_.server.name) -eq $env:computername}           
$serviceInstance.Provision();           
            
# Stop the Distributed Cache service by using Windows PowerShell       
   
$instanceName = "SPDistributedCacheService Name=AppFabricCachingService"           
$serviceInstance = Get-SPServiceInstance | ? {($_.service.tostring()) -eq $instanceName -and ($_.server.name) -eq $env:computername}           
$serviceInstance.Unprovision();


Thursday, September 10, 2015

Delete Search Service Application - SharePoint 2013

Can't delete SharePoint search service application from GUI? Here is a solution.


POWERSHELL

Run SharePoint Management Shell as Administrator.

$spapp = Get-SPServiceApplication -Name "Name Search Service Application"
Remove-SPServiceApplication $spapp -RemoveData


Or

Get-SPServiceApplication

$P = Get-SPServiceApplication -identity PutYourSearchApplicationGuidHere
Remove-SPServiceApplication $P
Remove-SPServiceApplication $P -RemoveData



STSADM


Open up a Command Prompt using Admin Rights

Change directory to: cd  C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\BIN

Type the STSADM command

stsadm -o deleteconfigurationobject -id [Search Service Application GUID ID]

Thursday, September 3, 2015

Cannot change Preferred Search Center in My Site Settings - SharePoint 2013

You can't change the search center for SharePoint My Site from the UI. The solution would be in powershell.














Open and run SharePoint Management Shell as Administrator.

Run next command

$ssa = Get-SPEnterpriseSearchServiceApplication "Search Service Application"
$ssa.SearchCenterUrl = "http://url/site/searchcentername/Pages/"
$ssa.Update

"Search Service Application" - name of  Search Service Application

When done do an IIS reset and try searching from your mysite.























Tuesday, September 1, 2015

My Site creation stuck at “We’re almost ready" SharePoint

The personal site managed path created on the web application hosting the Personal Site site collections, so why can't it find the correct managed path.  Well, in fact the User Profile application is not looking at the list of managed paths on the web application, it’s looking at the list of managed paths defined on the SPContentService.  

To find out what managed paths you have defined on your Content Service, you can run this bit of PowerShell from a SharePoint PowerShell console window:

Get-SPManagedPath -HostHeader








New-SPManagedPath -RelativeURL "personal" -HostHeader







To verify the command added the managed path correctly, re-execute the following PowerShell from a SharePoint console window:

Get-SPManagedPath –HostHeader