简体   繁体   中英

Task scheduler PowerShell Start-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:\Windows\system32\notepad.exe"

This is how it is configured to run. 在此处输入图片说明 在此处输入图片说明 Things I have tried, but still does not work.

  1. First of all, I am running under administrator account.
  2. In task schduler, run with highest privileges is checked.
  3. I have tried -ExecutionPolicy Bypass and -ExecutionPolicy RemoteSigned
  4. Under security policy have given my user Logon as batch job permission
  5. 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 .

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM