Powershell kill command issue

I am having an issue with Invoke Powershell activity. I have a command open an excel document but when I run the command to kill excel, UI Path errors out as if the command is not valid. I know it’s right because I enter it in Windows Powershell myself and excel closes. Anyone else have this issue?

I’m running a background process that requires an excel to open for the linked workbook to be updated. This is why I need to invoke Powershell, as I can not use another other UI activity with background process activities to close excel. I do not want to stop the whole process either, as I should remain running constantly.

Hi,

Do you have any error message? Can you share it if there is?

Regards,

@michael.twining

Can you try with Kill Process activity by passing Process Name as Excel to kill it.

Hi @michael.twining,

@Yoichi I can replicate your issue even after fixing the argument type returned from PowerShell (string). I am assumuing he is having the same error.

While PowerShell runs this command fine
image

Not investigated it fully, I have my doubts over the frontslashes in this command.


I think the issue here is the return value from the Invoke PowerShell activity. As you can see a taskkill command in PowerShell returns as message back to UiPath, if the

I would also recommend the solution from @lakshman because that way the execution stays in the same thread and UiPath does not need to wait for PowerShell. When execution is being performed in another program, UiPath does not retain the state so it either times out or just waits for the invoke activity to finish its execution. By using Kill Process activity, UiPath can adhere to its timeout properties in the project.

Hi @jeevith ,

We need to check IsScript option as the following.

kill

taskkill

Both work well, if excel process exists.

Regards,

1 Like

Offcourse!

I missed that (IsScript) before posting. The command should work fine from Invoke PowerShell.

So this is new to me, it ran the command, but now it errors out saying it can not find the excel. For some reason it is trying to run the powershell twice. So my workaround was to check continue on error and that works for what I need.

Thanks community for the help on this, is script checkbox definitely made the difference in the kill command.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.