Get-QARSOperation not working in Prod OnPostUndelete Event


I'm unable to run the 'Get-QARSOperation' cmdlet in production active roles console in the onpostundelete event. Do I need to do anything before run the cmdlet.

But I'm able to run same in Powershell command prompt and Powershell ISE and get the result a expected.

Could anyone please let me know why its not running in active roles console.