Home Powershell Activity
Options

Inconsistent error message in PS activity

Simon_ZeinhoferSimon_Zeinhofer Customer Ninja IT Monkey ✭✭✭✭
edited October 2023 in Powershell Activity

Hello guys,

we started rebuilding some of our automation by moving away from the SCO Activities to Powershell Activities.

Now it happens sometimes, that we receive an error in the output, and therefor the activity goes to failed:


The thing is, the script is still running through as if nothing happened. All steps are done and if it wasn't that system error, it would be completely normal. I also had a look inside the log file and there is no specific error documented. Right now this has only happened in 2 scripts, both using the Active Directory module. Also we invoke a session in both scripts.

Additionally we also have the situation, that a PSA has run, although it had status skipped - is there some error in the PSA workflow?


Has someone seen that before or has some sort of solution for that?

Best Answer

  • Options
    Simon_ZeinhoferSimon_Zeinhofer Customer Ninja IT Monkey ✭✭✭✭
    Answer ✓

    We found the error:

    Remove-CmDevice -Name %DEVICENAME% 
    

    deletes every object with that name, even if there are more than one. As we had a foreach loop to delete these devices, the 2nd attempt always failed.

    With pipelining we were able to solve this issue.

Answers

  • Options
    Justin_WorkmanJustin_Workman Cireson Support Super IT Monkey ✭✭✭✭✭

    @Simon_Zeinhofer - Is the PSA going to Completed status when this error is present? The error means there was an error in the PS execution. I only get this output when the PS throws an error then the PSA fails.

  • Options
    Simon_ZeinhoferSimon_Zeinhofer Customer Ninja IT Monkey ✭✭✭✭
    edited October 2023

    Hello Justin,

    no, the PSA goes to failed, although everything inside the script has been worked through successfully. That's what wonders me, because normally, when an error appears, the script fails on a certain point - then it is ok and it is good that the status goes to failed. But in this case, the steps inside the script are executed without an error.

    We think we can now narrow down this "System error" whenever 2 MEMCM devices (with the same name) are found and need to be deleted inside our session on the MEMCM management server. Unfortunately "System error" does not say a lot and when we run the script manually, everything works - and even in the PSA both MEMCM devices are deleted. So we need to investigate, what this error means and why it appears.

  • Options
    Simon_ZeinhoferSimon_Zeinhofer Customer Ninja IT Monkey ✭✭✭✭

    @Justin_Workman We think this is not a problem of the PS activitiy, but with the MEMCM module - We have to identify what triggers this system error, but we have now seen, that it really only happens, when there is more than 1 MEMCM asset found.

  • Options
    Simon_ZeinhoferSimon_Zeinhofer Customer Ninja IT Monkey ✭✭✭✭
    Answer ✓

    We found the error:

    Remove-CmDevice -Name %DEVICENAME% 
    

    deletes every object with that name, even if there are more than one. As we had a foreach loop to delete these devices, the 2nd attempt always failed.

    With pipelining we were able to solve this issue.

Sign In or Register to comment.