2

I'm trying to run process via powershell script on windows startup. Unforturnately, PC on which I running it is slow. In most of cases the Start-Process method "crashes" with message This command cannot be executed due to the error: The service did not respond to the start or control request in a timely fashion. Is there a way, to adjust this timeout or do something, to solve this problem? Line on which this issue appears:

Start-Process $AppPath -Credential $credential -WorkingDirectory $InstalationPath

EDIT: I tried also to set HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\ServicesPipeTimeout and HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\WaitToKillServiceTimeout to some big values (up to 1200000), but it doesn't help.

Hawex
  • 133
  • 13
  • This previous question should put you on the right path: https://stackoverflow.com/questions/36933527/powershell-start-process-wait-with-timeout-kill-and-get-exit-code – Scepticalist Jan 22 '19 at 12:23
  • Thanks, I'd read it before but it doesn't tell me anything. I just want to start this process and dont kill it. At this time my process don't start. – Hawex Jan 22 '19 at 12:35
  • 1
    From the error description, it seems you are starting a service. Can you show us the `$AppPath` content? Is it a service? Is it a process starting a service? Other? – Lieven Keersmaekers Jan 22 '19 at 13:10
  • It is an simple application written by me in C#. – Hawex Jan 22 '19 at 13:22
  • If you're sure it's simply a slow PC then just delay running the script until most of the normal startup process is complete? – Scepticalist Jan 23 '19 at 11:14
  • How can I do it in a proper way? If 2 minutes delay is ok for now, how I can know if it will be ok a year later? I don't know if there is a way to start executing script after all services is loaded. – Hawex Jan 23 '19 at 11:25
  • Related: [launch-script-after-windows-service-start](https://stackoverflow.com/questions/31606840/) – JosefZ Jan 28 '19 at 17:01

0 Answers0