none
Powershell recovery task not starting a background job RRS feed

  • Question

  • Hello,
    I'm trying to start a background job inside of a recovery action on a agent
    The recovery starts fine , executes some code and is creating a background job using "Start-Job" cmdelt  without any error
    I can see the background job ID and state (running) but nothing is happening
    part of this job is to log an event ID but is not happening 
    If I'm running the PS script manually as localsystem is creating the background job and the job is running fine by logging that event ID

    Thanks,
    Marius
    Thursday, May 18, 2017 7:34 PM

Answers

All replies

  • Hello,

    I suggest you change to use another run as account with local admin permission to run this recovery task. 

    You may also look into operations manager event log on the agent and check is there any related error messages.

    Regards,

    Yan Li


    Please remember to mark the replies as answers if they help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Friday, May 19, 2017 7:06 AM
    Moderator
  • Does't look is a permission issue since the script is behaving as expected when I'm manually run as same account as SCOM agent

    Looks to me there is a bug in the PowerShell version that the scom agent is using 

    Friday, May 19, 2017 3:20 PM
  • Hi Marius

    Have you seen this?

    https://rburri.wordpress.com/2015/08/19/which-powershell-version-is-my-scom-agent-using-or-why-i-love-scom-2012-r2-update-rollup-7/

    How are you running the recovery? Can you share the code?

    Have you tried System.CommandExecuterProbe module?

    Cheers

    Graham


    Blog - http://www.f1point2.com/ Twitter - @F1Point2_Graham

    • Marked as answer by MariusNY Friday, May 19, 2017 5:08 PM
    Friday, May 19, 2017 4:07 PM
    Moderator
  • Hi Graham,

    I'm running on 2012 R2 UR9 so in my case that link is not relevant, but you may be right, System.CommandExecuterProbe could be the answer, unfortunately I don't have the time to test it

    Instead of a monitor wit a recovery action that add a backgound job to do something I'me added a rule that probes for condition and as a writeaction for this rule I've added a PowerShellWriteAction that runs my code

    Thanks,

    Marius  

    Friday, May 19, 2017 5:08 PM
  • Hi Marius

    Why not then have the recovery action use the PowerShelWriteAction module instead?   You get to keep the health information, which is always good, down the line.

    Cheers!

    Monday, May 29, 2017 5:51 PM