java.util.NoSuchElementException when running discover now for SCCM Server Instances


When we try to run "Discovery Now" within "SCCM Server Instances" we get "java.util.NoSuchElementException".

Steps to reproduce:
1. Go to Client Software Distribution > SCCM Server Instances > <<YOUR SCCM INSTANCE NAME >> Discover Now
2. Go to Workflow All Contexts > Find the most recent record with version of "Discover SCCM" > Workflow Log to view the errors listed above


If you have any additional Write-Host statements in the mid server script files, especially

  1. Credentials.psm1

    2. PSRemoteSession.psm1

These statements will write to the output and this data was being passed to the post processing script of the powershell activity along with the payload which causes this error.


Please revert the files to OOB files (especially the above mentioned) or ensure the formatting of the output is intact.