2016 powershell scheduled tasks


i exported 3 scheduled tasks 2012 r2 server , imported them 2016 server. 3 of them have actions in format of:

start program
program/script: powershell
add arguments: &'\\server\share\script.ps1'

the script.ps1 part different on three, folder path same.

two of tasks run local system account. 1 of them runs domain account. worked fine on 2012r2. on 2016, 2 running local system account still run fine, domain account 1 not run. result 0x1, , return code 2147942401.

i've tried changing argument to:

-file "\\server\share\script.ps1"

with similar results.

if remove arguments, task runs. presumably opens powershell in background somewhere, because runs until kill it. doesn't throw 0x1 error. also, if change action "program/script:net" "add arguments:start" (net start) script again runs fine.

so issue seems passing arguments powershell.exe domain credentials, rather running scheduled task domain credentials, found when searched interwebs "scheduled task return code 2147942401".

"we forgot hook doll!" -weird science

\\server\share\script.ps1 not signed, , executionpolicy remotesigned. rdped 2016 server account running scheduled task , added file://server to intranet sites in internet explorer, , scheduled task runs fine existing syntax.

i'm assuming a. did on old 2012 server long enough ago have forgotten needed it, or b. server 2016 not processing group policy sets kind of thing same way 2012 servers process it.

i thought had tested 2016 server command prompt with

powershell .'\\server\share\script.ps1'

but apparently had not. because when did today got clear reminder script not being enough executionpolicy.

thank gentlemen.



Windows Server  >  Windows Server 2016 General



Comments

Popular posts from this blog

server manager error: ADAM.events.xml could not be enumerated.

Cannot access Anywhere Access using domain name?

WMI Failure: Unable to update Local Resource Group