Scheduled Task with Powershell script Failing with PS version 5.1.19041.1682

Copper Contributor

Hi all, 

 

I've noticed that a scheduled task running a powershell script doesn't work on version 5.1.19041.1682. But It does work with version 5.1.14393. (win 10/server 2016/2019)

 

We get the below screenshot "return code 4294770688". I can verify the script works by running manually and also tested creating a "test" script to just create a local c:\temp folder but keeps failing with same error via scheduled task.   

 

-ExecutionPolicy Bypass -File "\\serverName\SharedFolder\Script_Test.ps1" -> this is the command to execute the script on scheduled task and used to work perfect on previous 5.1.14 built. 

 

AstroTech_Repulsive_0-1657125169258.png

AstroTech_Repulsive_1-1657125713929.png

 

 

3 Replies

@farismalaeb 

Thank you for your reply! Unfortunately, I've tried these steps before with same results. Please see below screenshots N0.1 running powershell version 5.1.14. This works and executes the scheduled task. Screenshot No.2 running powershell 5.1.19 with return code 4294770688 (failing). This is the only common variable I'm finding on the environment. Every google suggestion about error 4294770688 doesn't work. 

- directory path is accessible, right ntfs permissions, checked " " quotes, re-created scheduled task etc.  

Thanks again! 

 

AstroTech_Repulsive_0-1657309019898.png

AstroTech_Repulsive_1-1657309290856.png

 

 

@AstroTech_Repulsive 

HI

I try it, these are my settings.

Name                           Value
----                           -----
PSVersion                      5.1.19041.1682
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.1682
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

I created a local share on my computer and created the task with a very basic script that writes info to the user's local profile. the script was executed from the shared folder, and the return code was 0 and all looks fine.

I am using Windows 10 21H2

If you use a local share, are you going to get the same error?