SharePoint Solution Deployment stucks in Retract / Deploy State

Problem Description:

I tried to deploy / retract a solution on a SharePoint farm, but the process never finishes. It stucked in “Deploying / Retracting” state forever.
In my case this was caused by disabled timer service instances.

Workaround:

I deployed the solutions with the parameter -Local on each server.

Final Solution:

$farm = Get-SPFarm
$disabledTimers = $farm.TimerService.Instances | where {$_.Status -ne “Online”}
foreach ($timer in $disabledTimers)
{
$timer.Status = [Microsoft.SharePoint.Administration.SPObjectStatus]::Online
$timer.Update()
}

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

Disable Form Field by using jQuery

Problem Description:

Usually you disable fields on forms by using SP Designer.
But if it’s a site content type, you can’t do it this way –> use a piece of Javascript

Resolution:

1. Download a jqueryxx.min.js file and place it in e.g. Site Assets library.

2. On the list settings choose the form web part you want to manipulate.
Then add a script web part and add following code (the correct title of the field you may find by inspect the element in the browser).

<script src=”http://PathToYourjQueryFile/jquery-xx.min.js” type=”text/javascript”></script>
<script type=”text/javascript”>
$(document).ready(function()
{
$(“input[Title=’YourFieldTitle’]”).attr(“disabled”, “disabled”);
});
</script>

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

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...