Author Posts

September 24, 2017 at 11:18 pm

I have the code below which has been fine until I installed V5.1 of PS. Now everytime I load the module with this code I get the recursion error. Cant figure out why it has changed...

Workflow Test-WFConnection {

    # Run multiple parallel "pings" so it runs quicker


  foreach -parallel ($computer in $computers) {

        Computer = $computer
        Reachable = (Test-Connection -ComputerName $computer -Count 1 -Quiet)

September 26, 2017 at 8:35 am

I ran your code in a Windows 2016 domain – PowerShell 5.1 – and it worked.

Test-Connection uses the Win32_PingStatus WMI class and requires a DCOM connection to the remote machine. I'd suggest testing Test-Connection against one of the failing remote machines directly rather than in the workflow. I'd also suggest that you test get-WMIObject against the failing machine to help determine if there is a DCOM issue

September 27, 2017 at 1:18 am

The code works. The problem is that when I load the module that has the above code in it I get the 'A workflow cannot use recursion' error. Don't know its giving me that error when the code actually works.

September 27, 2017 at 8:05 pm

Do you call the workflow within the module code?

October 9, 2017 at 8:44 pm

No – the module is imported at the start of an external script and the workflow is launched from there.
This code has not changed – it just started showing this 'error' since V5 or 5.1 of WMF.

October 28, 2017 at 12:08 am

It appears to be a bug. I just removed the workflow from my module.