Powershell cannot create Outlook COM object from Command Prompt

前端 未结 4 1233
别跟我提以往
别跟我提以往 2021-01-18 22:39

I have a script used to send mails via Microsoft Outlook from command prompt. This works fine if I run it from inside PowerShell or ISE console. But when I tried to execute

4条回答
  •  心在旅途
    2021-01-18 23:11

    CO_E_SERVER_EXEC_FAILURE in case of Outlook means the calling app and the COM server are running in different security contexts. If the command prompt is running with elevated privileges, either make sure Outlook is started with elevated privileges as well or that it does not run at all when your code is executed - this way Outlook will be started by your code and it will run with the same elevated privileges.

提交回复
热议问题