Stopping Services With An Unattended Robot

Hi everyone.

I have an automation that uses the invoke powershell activity to stop a service. I had to run UiPath as administrator for it to work. I am now trying to to run this automation using an unattended robot in service mode and I gave UiPath.service.host admin rights however it get the following error

Service ‘postgresql-x64-14 - PostgreSQL Server 14 (postgresql-x64-14)’ cannot be stopped due to the following error: Cannot open ‘postgresql-x64-14’ service on computer ‘.’.

Is there something else that needs to be done for it to run?

1 Like

Hi @mhaniff - Make sure that there are no applications or processes currently using PostgreSQL. Sometimes, if PostgreSQL is actively being accessed or utilized by an application, it cannot be stopped.

Hi. I found out it happens because you need to run powershell as an administrator to stop services. The following command used in the invoke powershell activity fixed the issue
"Start-Process powershell -Verb RunAs -ArgumentList 'stop-service ‘‘postgresql-x64-14’’ "

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