Sharepoint Workflow 2013: Comment arrêter un workflow 2013 en cours d'execution
SharePoint WORKFLOW 2013
Appel à la communauté SharePoint après avoir écumer le web et resté sans réponse:
Suite à une surcharge CPU à 99% en continue par le service "Microsoft.WorkFlow.ServiceHost", j'ai effectué les étapes de recherche suivantes:
* Execution de l'outil "Workflow Mananager Best practice analyser" pour vérifier la bonne installation/configuration du service de workflow, résultat: OK
* Vérification des workflows en cours d'éxecution via les "settings workflow" : je vois (pour mon workflow 2013 principal) "19 workfows en cours d'éxecution", mais aucun item n'est lié -apparement- à ces fils d'execution, du coup je ne peux pas les arrêter manuelement car je n'y pas accès
Usage de PowerShell avec les propriétés ".WorkflowAssociations" et ".RunningInstances" sur ma library: et là , je constate que mon script fonctionne parfaitement , sauf qu'il ne "ramenne" que les workflows 2010 !
* Edition du workflow 2013 collé à ma lib. : certains "stage" contiennent des "loop" qui attendent certaines valeures; même si ce workflow 2013 à été corrigé, les precedents version n'apparaissant pas du à v. 2013, d'ou ma question:
COMMENT SUPRIMER (.cancel) DES WORKFLOWS 2013 EN COURS D'EXECUTION non visible dans les items ?
HOW TO REMOVE "Workflows 2013 in Progress" when in sot visible into Items ?
et comment -via PowerShell- énumerer la liste des workflows 2013 en cours d'execution pour une bibliothèque ? sachant qu'on le fait très facilement pour des workflows 2010
Note Infra: 1 Serveur SQL 2012 (os: 2008 r2) sur lequel tourney le workflow manager + 1 Serveur SP 2013 (os: 2008 r2)
Merci d'avance et Bonne journée à tous
Pascal
ScrenShot - Get-WorkFlow - Workflow 2010 only :-(
MTS
Le code power shell:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| #Exemple Pour arrêter un workflow en cours
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$outputPath = "D:\BackupSP\resultat_lst_wf.txt"
#Site URL
$web = Get-SPWeb "http://mySharePoint2013.com";
Write-host $web
#$web.AllowUnsafeUpdates = $true;
#List Name
$list = $web.Lists["Purchase Order Request"];
Write-Host $list -ForegroundColor Red
# Iterate through all Items in List and all Workflows on Items.
foreach ($item in $list.Items)
{
if($item.Workflows.Count -gt 0)
{
Write-Host " "
$ligne2 = "[" + $item.ID + "] " + $item.Name + " intances workflow of item: " + $item.Workflows.Count
Write-Host $ligne2 -ForegroundColor Yellow
Add-Content -Path $outputPath -Value " "
ADd-content -Path $outputPath -Value $ligne2 #"["$item.ID"]"$item.Name " Nombre d'instances de workflow pour cet item: ("$item.Workflows.Count")"
}
foreach ($wf in $item.Workflows)
{
#Cancel Workflows
# [Microsoft.SharePoint.Workflow.SPWorkflowManager]::CancelWorkflow($wf);
if($wf.InternalState -eq "Running")
{
$ligne3 = " @'"+$wf.ParentAssociation.Name + "' /Status:" + $wf.InternalState + " /Completed?:"+$wf.IsCompleted + " /Running Inst:" + $wf.ParentAssociation.RunningInstances #$wf.IsLocked + " /LckItem:"+$wf.ParentAssociation.LockItem
Write-Host $ligne3 -ForegroundColor Green
Add-Content -Path $outputPath -Value $ligne3
}
}
}
$web.Dispose(); |