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

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
  • CategoryInfo : ResourceUnavailable: (:slight_smile: [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.

Hello 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://support.microsoft.com/en-us/help/257757/considerations-for-server-side-automation-of-office?wa=wsignin1.0%3Fwa%3Dwsignin1.0

 

Hope that helps.