Timeouts when creating new service application on SharePoint

Problem Description:

Error: “Timeout Expired. The timeout period elapsed prior to completion of the operation or the
server is not responding.​”

This can be caused due too many rows in the SharePoint_Config DB in table dbo.TimerJobHistory

You can check on SQL with the following code:

SELECT CONVERT(bigint, rows)
FROM sysindexes
WHERE id = OBJECT_ID(‘dbo.TimerJobHistory’)
AND indid < 2

The root problem is a general SP 2013 “beature”.
The job “Delete Job History” is scheduled weekly but has a timeout. That causes, that ususally a lower number of entries is purged after a week than new entries created during the week on a large farm.

Resolution:

​Set the job schedule to 1 minute until you reached a lower and stable number of rows.
After that change the job to run daily.

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Removing all broken inhertiance and permissions complete site collection

Problem Description:

if you need to remove all permissions and broken inheritances from a complete site collection, you may run this script​

Resolution:

Add-PSSnapin Microsoft.SharePoint.PowerShell
$site = Get-SPSite https://URL
$webs = $site.AllWebs
foreach ($web in $webs){
if ( ($web.HasUniqueRoleAssignments) -and ($web.IsRootWeb -eq $false ) ){
$web.ResetRoleInheritance()}
Write-Host “Removed broken inheritance on web: ” $web.Url -ForegroundColor Red
}

$lists=$web.Lists
foreach ($list in $lists){
if (($list -ne $null) -and ($list.HasUniqueRoleAssignments)){
$list.ResetRoleInheritance()
Write-Host “Removed broken inheritance on list: ” $list.Title -ForegroundColor Blue
Clear-Variable list
}

Write-Host “Entering list to remove single item permission: ” $list.Title
$items = $list.items | Where {$_.HasUniqueRoleAssignments}
foreach ($item in $items){
$item.ResetRoleInheritance()
Write-Host “Removed broken inheritance on item: ” $item.Name -ForegroundColor Green
Clear-Variable item
}}
$web.Dispose()
}

Remove all permissions
$groups = $web.SiteGroups
for ($i=0;$i -le $groups.Count;$i++){
$web.SiteGroups.Remove($groups[$i])
}
$users = Get-SPUser -Web $web -Limit all
for ($i=0;$i -le $users.Count;$i++){
Remove-SPUser -Web $web -Identity $users[$i] -Confirm:$false
}

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

How to terminate SharePoint 2013 Designer Workflow on PowerShell

Problem Description:

SharePoint Designer Workflows in version 2013 couldn’t be terminated on the GUI because they were in an undefined state​

Resolution:

​$web=get-spweb https://URL
$list=$web.lists[“ListName”]
$wfm=New-Object Microsoft.SharePoint.WorkflowServices.WorkflowServicesManager($list.ParenWeb)
$wfm.GetWorkflowInstanceService()
$wfs=$wfi.EnumerateInstancesForListItem($list.ID,”$itemID”)
$wfi.TerminateWorkflow($wfs[0])

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Reporting Subscriptions stucks in status “Pending” after domain user migration

Problem Description:

after a user’s account has been migrated from sourdeomain to targetdomain, the subscriptions created with that user account stopped working.​

Resolution:

stsadm migration on SharePoint doesn’t fix this problem; you have to manually change the subscription users in the database of the SharePoint Reporting service application.

To identify:

​SELECT
jobs.name AS JobName,
C.path AS ReportPath,
C.name AS ReportName,
u.username AS SubscriptionOwner
FROM dbo.ReportSchedule RS
JOIN msdb.dbo.sysjobs jobs
ON CONVERT(varchar(36), RS.ScheduleID) = jobs.name
INNER JOIN dbo.Subscriptions S
ON RS.SubscriptionID = S.SubscriptionID
INNER JOIN dbo.Catalog C
ON s.report_oid = C.itemid
INNER JOIN dbo.users u
ON s.ownerid = u.userid

To fix:

DECLARE @OldUserID uniqueidentifier
DECLARE @NewUserID uniqueidentifier
SELECT @OldUserID = UserID FROM dbo.Users WHERE UserName = ‘sourcdomain\firstname.lastname’
SELECT @NewUserID = UserID FROM dbo.Users WHERE UserName = ‘targetdomain\firstname.lastname’
UPDATE dbo.Subscriptions SET OwnerID = @NewUserID WHERE OwnerID = @OldUserID

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...