Recently I was working on a PowerShell Workflow for Auto Group Assignment for Service Requests and Incidents for a customer and ran into a snag… Effectively, although the script appeared to be running as it should and the Support Group would auto-assign I received the following error:
System.TimeoutException: The operation has timed out.
at Microsoft.EnterpriseManagement.TaskRuntimeManagement.ExecuteTaskInternal[T](IEnumerable`1 targets, Guid taskId, TaskConfiguration configuration)
at Microsoft.EnterpriseManagement.TaskRuntimeManagement.ExecuteTask[T](IEnumerable`1 targets, ManagementPackTask task, TaskConfiguration configuration)
at Microsoft.ServiceManager.WorkflowAuthoring.ActivityLibrary.TaskExecutor.RunTask(String sdkServerName, Guid taskId, IList`1 taskTargetIds, Dictionary`2 taskArguments, Int32 taskTimeout)
at Microsoft.ServiceManager.WorkflowAuthoring.ActivityLibrary.RunTaskActivity.Execute(ActivityExecutionContext executionContext)
at System.Workflow.ComponentModel.ActivityExecutorOperation.Run(IWorkflowCoreRuntime workflowCoreRuntime)
Multiple re-creations of my workflow using the authoring tool and manual script execution showed the script was working as intended. It turns out the issue was that the SQL Broker wasn’t enabled for the ServiceManager Database, thankfully an easy fix.
- Stopped the SQL Server Agent
- Stopped all Service Manager related services
- Checked the Broker Enabled Status via SQL Query: SELECT is_broker_enabled from sys.databases WHERE name = ‘ServiceManager’. This returned 0 (it wasn’t enabled)
- Ran the Query ALTER DATABASE ServiceManager SET ENABLE_BROKER. Note: If it times out due to a lingering connection, “alter database ServiceManager set enable_broker with rollback immediate;” does the trick too.
- Restarted the SQL Server Agent and all Service Manager services and Workflows now run as expected!