powershell - How to run an Event (FileSystemWatcher) through Task Scheduler -


i have pretty simple powershell script creates io.filesystemwatcher object, , calls executable upon event being triggered.

i can run script without issue administrator powershell on 2012 windows server, seems run issues when have script being run task scheduler.

i've attempted running task while logged on, , on trigger while i'm logged off , in both instances event status reads: "running" when check. interacting folder should watched produces no results. i've added log file document parts of code functioning , script create event, event triggering seems issue. has heard of issue creating events through task scheduler?

i've read forums might domain user issue

hkey_local_machine\system\currentcontrolset\control\lsa

change ‘reg_dword’ valuename ‘disabledomaincreds’ value “0

although case, , i've tried multiple variations of settings in task properties per scripting guy , spiceworks. general consensus i've found needs ran -noexit argument in order event run when user not logged in.

extra notes:

  • powershell script located on network location rather physically on computer (\servername\ftp\folder\script.ps1

i came across same problem. don't know why works, in scheduled task, when referring powershell script, instead of using

\servername\ftp\folder\script.ps1 

use

. \servername\ftp\folder\script.ps1 

(noting .).


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -