您好有办法将所有2013年工作流程检索到SharePoint网站吗?我们的服务器存在这个问题,WorkFlow Manager 2013使用我们所有的服务器资源,导致100%的CPU使用率,我们需要知道造成这种情况的用户创建的工作流程。
截至目前,我有以下代码将所有WF 2010检索到以下网站:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ea 0
$site=Get-SPSite("mysite dot com");
#Initialize Workflow Count variable
$workflowcount = 0
#Foreach loop to loop through all webs, and lists with workflow associations, and exclude workflows that have previous versions and write findings to .csv file.
function Get-Workflows()
{
foreach($web in $site.AllWebs)
{
foreach($list in $web.Lists)
{
foreach($wf in $list.WorkflowAssociations)
{
if ($wf.Name -notlike "*Previous Version*")
{
$hash = @{"[URL]"=$web.Url;"[List Name]"=$list.Title;"[Workflow]"=$wf.Name}
New-Object PSObject -Property $hash | Sort-Object
}
}
}
}
}
foreach($web in $site.AllWebs)
{
foreach($list in $web.Lists)
{
foreach($wf in $list.WorkflowAssociations)
{
if ($wf.Name -notlike "*Previous Version*")
{
$workflowcount += 1
}
}
}
}
Get-Workflows | Export-csv C:\Users\Documents\rey.csv
"Workflow Count " + $workflowcount >> C:\Users\Documents\rey.csv
$site.Dispose()
感谢任何帮助。
谢谢!
答案 0 :(得分:1)
您可以尝试使用此功能来获取网站中的所有2013年工作流程。
$web = Get-SPWeb -identity $url
$wfm = New-object Microsoft.SharePoint.WorkflowServices.WorkflowServicesManager($web)
$defSevice = $wfm.GetWorkflowDeploymentService()
$wfDefs = $defSevice.EnumerateDefinitions($false)
foreach ($wfDef in $wfDefs){
$wfDef.properties
}
$ wfDef.properties将列出与工作流有关的所有属性。与RestrictToScope一样,它为您提供关联列表的GUID。