s2.OperationsManager.Trace.Help.3bStartWorkflowTracing.WriteAction (WriteActionModuleType)

Element properties:

TypeWriteActionModuleType
IsolationAny
AccessibilityInternal
RunAsDefault
InputTypeSystem.BaseData
OutputTypeSystem.BaseData

Member Modules:

ID Module Type TypeId RunAs 
PowerShellWriteAction WriteAction Microsoft.Windows.PowerShellWriteAction Default

Source Code:

<WriteActionModuleType ID="s2.OperationsManager.Trace.Help.3bStartWorkflowTracing.WriteAction" Accessibility="Internal" Batching="false">
<Configuration>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="traceCmd" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="TimeoutSeconds" type="xsd:integer"/>
</Configuration>
<OverrideableParameters/>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<WriteAction ID="PowerShellWriteAction" TypeID="Windows!Microsoft.Windows.PowerShellWriteAction">
<ScriptName>Run-WorkflowTracing.ps1</ScriptName>
<ScriptBody><Script>param(
[Parameter(Mandatory=$true)]
$traceCmd # needs to be either Stop or Start
)

$regKey = "HKLM:\SOFTWARE\Microsoft\Microsoft Operations Manager\3.0\Setup"
$installDir = (Get-ItemProperty -path $regKey -Name InstallDirectory).InstallDirectory
$ChildPath = "Tools\tracelogsm.exe"
$runCmd = Join-Path -Path $installDir -ChildPath $ChildPath

if ($traceCmd -eq "Start") {
write-host "Start SCOM tracing..." -ForegroundColor green
Invoke-Command -ScriptBlock {&amp;$runCmd -start `"WorkflowTrace`" -flag 0xFF -level 5 -ft 1 -rt -guid `"#c85ab4ed-7f0f-42c7-8421-995da9810fdd`" -b 1024 -f $env:windir\logs\opsmgrtrace\WorkFlowTrace.etl}
"-"*50
write-host "Done." -ForegroundColor green
Write-Host "
WorkflowTrace only works when the TraceEnabled override is configured as described here:
https://blogs.technet.microsoft.com/momteam/2013/10/31/how-to-analyze-a-workflow-when-the-opsmgr-workflow-analyzer-doesnt-work"
}

if ($traceCmd -eq "Stop") {
write-host "Stop SCOM tracing..." -ForegroundColor green
#$stopCmd = "$runCmd -stop `"WorkflowTrace`""
#&amp;cmd.exe /c "$stopCmd"
Invoke-Command -ScriptBlock {&amp;$runCmd -stop `"WorkflowTrace`"}
"-"*50
write-host "Done." -ForegroundColor green
}</Script></ScriptBody>
<Parameters>
<Parameter>
<Name>traceCmd</Name>
<Value>$Config/traceCmd$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
</WriteAction>
</MemberModules>
<Composition>
<Node ID="PowerShellWriteAction"/>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.BaseData</OutputType>
<InputType>System!System.BaseData</InputType>
</WriteActionModuleType>