SharePoint 2013 Customization Decision Tree

When you need to do customization in SharePoint 2013 – you need to follow the right path….

Get the PDF here: https://sharepointgadget.files.wordpress.com/2016/04/sharepoint-2013-customization-decision-tree.pdf

 

Leave a comment

PowerShell script to test Word Automations Services in SharePoint 2013

Troubleshooting Word Automation Service can be tricky. So I created a Powershell script til help you……..

1. Create and upload word document (ex. test.docx)

2.Change variables in script

3. Run script

#————————————————————————————————

# Test Word Automation Service for Sharepoint 2013

#————————————————————————————————

# 30-08-2014 Martin Bøjstrup

#

$AppName=“Word Automation Service Application”

$SiteUrl= http://team.domain.com

$WordDoc=“/Shared%20Documents/test.docx”

$PDF=“/Shared%20Documents/test.docx”

asnp  *sh*

Write-Host -BackgroundColor Green -ForegroundColor Yellow ” — Test Word Automation Service Instance— “

write-host “”

$WASinstance=Get-SPServiceInstance | ?{$_.typename -eq “Word Automation Services”}

IF ($WASinstance.Status -ne  “Online”)

{

    Write-Host -ForegroundColor Red -BackgroundColor White ” – Service Instance not started !! – Status: ” $WASinstance.Status

    Write-Host ”  – Run to start: (Get-SPServiceInstance | ?{$_.typename -eq “Word Automation Services”}).Provision()”

    break

}

Write-Host -ForegroundColor Green ”  – Service instance Online”

Write-Host -BackgroundColor Green -ForegroundColor Yellow ” — Test Word Automation Service Application — “

Write-Host “Check service application: “$AppName

$was=Get-SPServiceApplication -Name $AppName -ErrorAction SilentlyContinue

if (!$was)

{

    Write-Host -ForegroundColor Red -BackgroundColor White ” – Service application not found !!”

    break

}

Write-Host -ForegroundColor Green ”  – Service application found”

Write-Host -ForegroundColor Green ”  – Status : “$was.Status

Write-Host -BackgroundColor Green -ForegroundColor Yellow ” — Send convert job to Word Automation Service — “

Write-Host “Convert Word document to PDF : “$SiteUrl $WordDoc

[void][System.Reflection.Assembly]::LoadWithPartialName( “Microsoft.Office.Word.Server” )

 $ConvertJob = New-Object Microsoft.Office.Word.Server.Conversions.SyncConverter($AppName)

$ConvertJob.UserToken = (Get-SPWeb $SiteUrl).CurrentUser.UserToken

$ConvertJob.Settings.UpdateFields = $true

$ConvertJob.Settings.OutputFormat = “PDF”

$ConvertJob.Convert($SiteUrl+$WordDoc,$SiteUrl+$PDF);

Write-Host -ForegroundColor Green “— Test done —“

If job is failing with the this error I ULS – “Failed to launch sandbox process, SE_ASSIGNPRIMARYTOKEN_NAME and SE_INCREASE_QUOTA_NAME privileges are required

That means that service application pool account must have the SE_ASSIGNPRIMARYTOKEN_NAME and SE_INCREASE_QUOTA_NAME user rights to start processes.
To assign user rights to an account on the local computer

1.      From the Start menu, point to Administrative Tools, and then click Local Security Policy.

2.      In the Local Security Settings dialog box, double-click Local Policies, and then double-click User Rights Assignment.

3.      In the details pane, double-click Adjust memory quotas for a process. This is the SE_INCREASE_QUOTA_NAME user right.

4.      Click Add User or Group, and, in the Enter the object names to select box, type the user or group name to which you want to assign the user right, and then click OK.

5.      Click OK again, and then, in the details pane, double-click Replace a process level token. This is the SE_ASSIGNPRIMARYTOKEN_NAME user right.

6.      Click Add User or Group, and, in the Enter the object names to select box, type the user or group name to which you want to assign the user right, and then click OK.


1 Comment

SharePoint 2013 training for IT pros

http://technet.microsoft.com/en-US/sharepoint/fp123606

Leave a comment

WOPI Overview – Office Web Apps Server and SharePoint

Here is a drawing I made to understand WOPI request with Office Web Apps Server and SharePoint.

Get the PDF here: https://sharepointgadget.files.wordpress.com/2012/02/wopi-overview.pdf

Leave a comment

SharePoint (Performance, Stress ) Load Testing

http://blogs.msdn.com/b/sanjaynarang/archive/2009/04/18/sharepoint-performance-stress-load-testing.aspx

Leave a comment

SharePoint 2010 links for new IT PROs (version 2011)

http://www.sharepointusecases.com/index.php/2011/10/sharepoint-2010-links-for-new-it-pros-version-2011/

Leave a comment

Send-crawlhealth

===================================================================================
# Script: Send-CrawlHealth
# Desc: Get Crawl Health and send the resualt i a e-mail
# Returns: Array of ContentSources and health
# ===================================================================================

#region Assembly
[reflection.assembly]::LoadWithPartialName(“Microsoft.SharePoint”) | out-null
[reflection.assembly]::LoadWithPartialName(“Microsoft.Office.Server”) | out-null
[reflection.assembly]::LoadWithPartialName(“Microsoft.Office.Server.Search”) | out-null
#endregion

#Region Threshholds
$crawlFreshnessDayThreshhold = 2
$crawlDurationHourThreshhold = 4
$successRatioThreshhold = 0.9
#endregion

#region Function Calculate-CrawlDuration
# ===================================================================================
# Func: Calculate-CrawlDuration
# Desc:
# Param: contentSource object
# ===================================================================================
function Calculate-CrawlDuration
{
param
([Microsoft.Office.Server.Search.Administration.SharePointContentSource]$contentSource)

if ($contentSource.CrawlStatus -eq [Microsoft.Office.Server.Search.Administration.CrawlStatus]::Idle)
{
return “OK – Idle”
}
# crawl running
$timespan = [datetime]::Now – $contentSource.CrawlStarted
$timespanFormatted = “Running for $($timespan.TotalDays.ToString(‘0.00’)) Days” +
“($($timespan.TotalHours.ToString(‘0.0’)) hours)”

if ($timespan.TotalHours -le ($crawlDurationHourThreshhold))
{
return “OK – $timespanFormatted”
} else {
return “Error – Threshhold exceeded – $timespanFormatted”
}
}
#endregion

#region Function Calculate-CrawlFreshness
# ===================================================================================
# Func: Calculate-CrawlFreshness
# Desc:
# Param: contentSource object
# ===================================================================================
function Calculate-CrawlFreshness
{
param
([Microsoft.Office.Server.Search.Administration.SharePointContentSource]$contentSource)

$timespan = [datetime]::Now – $contentSource.CrawlCompleted
$timespanFormatted = “$($timespan.TotalDays.ToString(‘0.00’)) days ago”
if ($timespan.Days -lt $crawlFreshnessDayThreshhold)
{
return “OK – $timespanFormatted”
}
else
{
return “Error – Threshhold exceeded – $timespanFormatted”
}
}
#endregion

#region Function Calculate-IndexHealth
# ===================================================================================
# Func: Calculate-IndexHealth
# Desc:
# Param: contentSource object
# ===================================================================================
function Calculate-IndexHealth
{
param
([Microsoft.Office.Server.Search.Administration.SharePointContentSource]$contentSource,
$successCount, $warningCount, $errorCount)

$formatted = “(Success:$($successCount)/Warnings:$($warningCount)/Error:$($errorCount))”
if ($errorCount -eq 1)
{
return “Error – exactly 1 error, usually indicates permissions/config error – $formatted”
}
$successRatio = ([double]$successCount)/([double]($warningCount + $errorCount))
if ($successRatio -ge $successRatioThreshhold)
{
return “OK – $formatted”
} else {
return “Error – Threshhold exceeded- $formatted”
}
}
#endregion

#region Function Get-CrawlHealth
# ===================================================================================
# Func: Get-CrawlHealth
# Desc: Get Crawl Health and return array with healthdata
# Returns: Array of ContentSources and health
# ===================================================================================
function Get-CrawlHealth
{
$serverContext = [Microsoft.Office.Server.ServerContext]::Default
$searchContext = [Microsoft.Office.Server.Search.Administration.SearchContext]::GetContext($serverContext)

$content = [Microsoft.Office.Server.Search.Administration.Content]$searchContext
$history = [Microsoft.Office.Server.Search.Administration.CrawlHistory]$searchContext

$contentSources = $content.ContentSources | foreach { $_ }

$contentSources | foreach {
#unroll DataTable object into more useful DataRow object
$crawlHistory = $history.GetLastCompletedCrawlHistory($_.Id) | % { $_ }
add-member -inputobject $_ -membertype NoteProperty -name “CurrentCrawlDuration” -value (
Calculate-CrawlDuration $_)
add-member -inputobject $_ -membertype NoteProperty -name “CompletedCrawlFreshness” -value (
Calculate-CrawlFreshness $_)
add-member -inputobject $_ -membertype NoteProperty -name “IndexHealth” -value (
Calculate-IndexHealth -contentSource $_ -successCount $crawlHistory.SuccessCount -warningCount (
$crawlHistory.WarningCount) -errorCount $crawlHistory.ErrorCount)
}

$contentSources | select Name, CurrentCrawlDuration, CompletedCrawlFreshness, IndexHealth
}
#endregion

# Send E-mail

$emailFrom = “from@yourdomain.com”
$emailTo = “to@yourdomain.com”
$subject = “CrawlHealth”
$body = Get-CrawlHealth | Format-List | Out-String
$smtpServer = “your smtp server”
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$smtp.Send($emailFrom, $emailTo, $subject, $body)

Leave a comment