Process is not running

I have this simple script on Windows 10, which works fine when just executing, but fails to start notepad when running from task scheduler. Stop-Process works perfectly, Start-Process does not run. When I run it on demand, it closes the notepad and then keeps running without opening notepad, the task does not close also.

Stop-Process -processname notepad
Start-Process "C:Windowssystem32notepad.exe"

This is how it is configured to run. 在这里输入图像描述在这里输入图像描述 Things I have tried, but still does not work.

  • First of all, I am running under administrator account.
  • In task schduler, run with highest privileges is checked.
  • I have tried -ExecutionPolicy Bypass and -ExecutionPolicy RemoteSigned
  • Under security policy have given my user Logon as batch job permission
  • Turn UAC off

  • The application was ran in background. To make it run on foreground, had to check the box Run only when user is logged on .

    在这里输入图像描述

    链接地址: http://www.djcxy.com/p/89660.html

    上一篇: 在Powershell中等待命令

    下一篇: 进程没有运行