Powershell - cannot bring target application to foreground

Hi all,
Bot is trying to run PowerShell as admin in unattended mode, but it is throwing “cannot bring target application to foreground” which was not seen in attended mode and also while inspecting the unattended bot run via RDP. I’m not sure what is causing the issue, can anyone help?
Thank you

@sunless

Welcome to the community

Are you using ui on powershel?

ideally you need to use invoke powershell

cheers

Hi @sunless

Does bot have any other steps or just powershell script run in it as this error is related to UI activities?

Also, what does your powershell script contains?

This error indicating your robot isn’t installed in service mode.

Check and install in service mode of it isn’t.

But I need to login to Microsoft account from PowerShell. So, I think invoke PowerShell activity may not be helpful.

Not PowerShell script but Bot enter couple of commands in PowerShell and tries to connect to Microsoft account

@sunless

You can login to your account as well

Whatever comman you use there can be accomodated here as well

Also if you can tell what you are trying to acheive may be we can give any alternatives if present

Cheers

I’m trying to connect power bi service account

@sunless

ideally for power bi or power platform to connect with other resources if from on prem then we need to use microsoft data gateway or api would be the best option any specific reason that you want to do it through powershell?

Now coming to original issue of foreground error ..did you happen to check the video of the run?..also if its failign at login step we might need to see what specifically is there in foreground …

cheers