Share via


Powershell script cannot run as scheduled task-error 0xfffd0000

Question

Tuesday, September 27, 2016 6:00 PM | 1 vote

Hello everyone,

I have a set of PowerShell scripts that are designed to copy email archives from a user's hard drive to a network location.  The computer in question runs Windows 10 Pro 64-bit.  The scripts differ only in where the archives are copied to (to keep multiple sets in case of corruption).  The user has full control of the folder where the scripts are housed, as well as the target network location.  When I run the scripts in PowerShell, they work fine.  However, when I run them as scheduled tasks, I get a 0XFFFD0000 result each time.  Prior research for this code is scant, but indicates some sort of permission problem.  

This is what I use for the scheduled task under the "Action" section:

Start a program:  

powershell.exe -NoProfile -NoLogo -NonInteractive -ExecutionPolicy Bypass -File “C:\scripts\PowerShellScript-Copy-email-USER-W1.ps1”

Here's the history output from one of the scheduled tasks (domain name altered):

Log Name:      Microsoft-Windows-TaskScheduler/Operational

Source:        Microsoft-Windows-TaskScheduler

Date:          9/27/2016 12:51:54 PM

Event ID:      102

Task Category: Task completed

Level:         Information

Keywords:      (1)

User:          XXXX\TIM

Computer:      TIMH3-PC-W10.XXXX.COM

Description:

Task Scheduler successfully finished "{c4a6317b-2b4a-41b0-ac3d-f76ccd411e52}" instance of the "\Copy Email Archives-Week 1" task for user "XXXX\TIM".

Event Xml:

<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">

  <System>

    <Provider Name="Microsoft-Windows-TaskScheduler" Guid="{DE7B24EA-73C8-4A09-985D-5BDADCFA9017}" />

    <EventID>102</EventID>

    <Version>0</Version>

    <Level>4</Level>

    <Task>102</Task>

    <Opcode>2</Opcode>

    <Keywords>0x8000000000000001</Keywords>

    <TimeCreated SystemTime="2016-09-27T16:51:54.738690400Z" />

    <EventRecordID>191475</EventRecordID>

    <Correlation ActivityID="{C4A6317B-2B4A-41B0-AC3D-F76CCD411E52}" />

    <Execution ProcessID="6252" ThreadID="5420" />

    <Channel>Microsoft-Windows-TaskScheduler/Operational</Channel>

    <Computer>TIMH3-PC-W10.XXXX.COM</Computer>

    <Security UserID="S-1-5-21-2722995020-1940175791-2104924280-1128" />

  </System>

  <EventData Name="TaskSuccessEvent">

    <Data Name="TaskName">\Copy Email Archives-Week 1</Data>

    <Data Name="UserContext">XXXX\TIM</Data>

    <Data Name="InstanceId">{C4A6317B-2B4A-41B0-AC3D-F76CCD411E52}</Data>

  </EventData>

</Event>

I've used the same script on numerous Windows 7 computers with no problems, and worded the scheduled task the same (all have Win 7 Pro 64-bit). The only difference is in the path to the destination referenced in the script (UNC naming is used in each case), and the script name is customized per the individual computer.  The scripts are stored in the same location on each computer as well.  Can anyone shed some light on this?  Am I not setting something up right?

Thanks in advance,

Michael

EDIT:  I have the tasks set to run whether the user is logged in or not (password is stored), and the "Run with highest privileges" option is checked.  Also,  under the "Configure for:" window, I've tried every available setting (Windows Vista, Windows Server 2008; Windows 7, Windows Server 2008 R2; Windows Server 2012; Windows 10) with no success.

All replies (4)

Tuesday, September 27, 2016 7:25 PM ✅Answered | 13 votes

0XFFFD0000 appears for some a path error. So is the path for the ps1 correct?

Try as the program;

%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe

and as the action;

-NoProfile -NoLogo -NonInteractive -ExecutionPolicy Bypass -File “C:\scripts\PowerShellScript-Copy-email-USER-W1.ps1”


Wednesday, September 28, 2016 12:18 PM | 1 vote

Hi Mr Happy,

Thank you for your reply.  That worked.  I created a new task from scratch, this time trying your suggestion for the program path to access PowerShell.  I ran the task manually and it ran with no problems.  Thank you very much for your help.

Michael


Friday, February 23, 2018 3:30 PM

Solved a similar problem for me. I'll be doing all my scheduled tasks running PowerShell this way now.


Thursday, November 15, 2018 7:11 PM | 1 vote

In my case, it was simply a typo in the path.  Copy and Paste out what you have in the Scheduled Task property to a notepad and review letter by letter to ensure the path is accurate.