# Schedule Task | Reading email from Outlook | 80080005 Server execution failed

**URL:** https://forums.powershell.org/t/schedule-task-reading-email-from-outlook-80080005-server-execution-failed/14449
**Category:** PowerShell Help
**Created:** [May 29, 2020, 5:33am UTC](https://forums.powershell.org/t/schedule-task-reading-email-from-outlook-80080005-server-execution-failed/14449 "2020-05-29T05:33:31Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![munish62801](https://avatars.discourse-cdn.com/v4/letter/m/8c91f0/32.png) [@munish62801](https://forums.powershell.org/u/munish62801)
#### Post date: [May 29, 2020, 5:33am UTC](https://forums.powershell.org/t/schedule-task-reading-email-from-outlook-80080005-server-execution-failed/14449/1 "2020-05-29T05:33:31Z")

</div>

Hi All,

I am trying to read emails via ps script from outlook and it works fine (without any pop-up).

I have configured a schedule task to run as my user and trying to run the same script but it fails with error:

TerminatingError(New-Object): “Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO\_E\_SERVER\_EXEC\_FAILURE)).”  
New-Object : Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed  
due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005  
(CO\_E\_SERVER\_EXEC\_FAILURE)).

- $Outlook = New-Object -comobject Outlook.Application
- 

```auto

```

- CategoryInfo : ResourceUnavailable: (🙂 [New-Object], COMException
- FullyQualifiedErrorId : NoCOMClassIdentified,Microsoft.PowerShell.Commands.NewObjectCommand  
New-Object : Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed  
due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005  
(CO\_E\_SERVER\_EXEC\_FAILURE)).

I have added logging functionality to my script to confirm that the schedule task is running my under context and not the system context.

My goal is to create schedule task, which retrieves emails from outlook and create custom email alerts.

Any help with the above error or suggestion about any other method/strategy would be highly appreciated.

---

<div class="post-metadata">

### Author: ![andysvints](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/andysvints/32/1017_2.png) [@andysvints](https://forums.powershell.org/u/andysvints)
#### Post date: [May 29, 2020, 8:08am UTC](https://forums.powershell.org/t/schedule-task-reading-email-from-outlook-80080005-server-execution-failed/14449/2 "2020-05-29T08:08:31Z")

</div>

Hello [munish62801](https://powershell.org/profile/munish62801/),

It is known issue, please refer to the following thread:

[https://stackoverflow.com/questions/29772500/powershell-cannot-create-outlook-com-object-from-command-prompt](https://stackoverflow.com/questions/29772500/powershell-cannot-create-outlook-com-object-from-command-prompt)

> **[Considerations for server-side Automation of Office](https://support.microsoft.com/en-us/topic/considerations-for-server-side-automation-of-office-48bcfe93-8a89-47f1-0bce-017433ad79e2)**
>
> Describes problems when using server-side Automation of Office and offers alternatives to Automation that can speed performance.

&nbsp;

Hope that helps.

---

<div class="post-metadata">

### Author: ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)
#### Post date: [May 16, 2024, 8:29pm UTC](https://forums.powershell.org/t/schedule-task-reading-email-from-outlook-80080005-server-execution-failed/14449/3 "2024-05-16T20:29:28Z")

</div>


