Failure creating an Outlook application object on Vista
While creating a Outlook application object from another process in C# like:
outlook = new Microsoft.Office.Interop.Outlook.Application();
or powershell
PS> $outlook = new-object -com Outlook.Application
or straight up COM via CoCreateInstance on Vista it's possible to receive the following error:
Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005
Error 0x80080005 (CO_E_SERVER_EXEC_FAILURE) is sort of a generic COM error message that occurs for many reasons while calling CoCreateInstance. One reason someone could receive this error is because the client process and the server process (outlook.exe in this case) are running at different integrity levels. By default it doesn't appear that COM likes talking across two different processes that are running at different integrity levels. There supposedly is a way to implement the COM server in such a way to support it but currently the Outlook COM server doesn't support it.
People who develop their applications on Vista using Visual Studio, which runs at integrity level high by default, will run into this issue often when Outlook is already running. By default Outlook runs at integrity level medium and if the client application is run from Visual Studio it will inherit the high integrity level and thus there will be an integrity level mismatch.
To fix this one needs to make the integrity levels match so either start the client application outside Visual Studio at the normal medium integrity level or run Outlook at the high integrity level (i.e. as Administrator). However it is not recommended to run Outlook at integrity level high all the time. Another way to deal with this is to ensure Outlook is not already running so COM will start the process at the correct integrity level of the client process that created the application object.
I don't know of any way to detect this exact situation programmatically but process explorer works well for manually checking the integrity levels of processes.