Outlook Automation Error When Connecting From Elevated Prompt


One thing I didn’t realize until the other day is that a Vista command prompt that is elevated is unable to control Outlook. I was testing some JScript code from an elevated prompt and got this error:

Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Users\psheed\SendMail.js(1, 1) Microsoft JScript runtime error: Automation server can't create object

Unfortunately the error message isn’t very helpful in diagnosing the problem. After trying a few things I eventually found out that the script would work fine if it was running from a non-elevated prompt. Now it makes sense, you can’t use code that is running elevated to control non-elevated code for security reasons.

, ,

  1. No comments yet.
(will not be published)