3

I've written an application which creates Word documents from a template. I had a bunch of issues getting that function to work, but I did it by editing permissions Component Services permissions. Now it works if I manually click the executable, or if the Task Scheduler runs it while I'm logged in, but not if I have it scheduled to run and I'm logged out.

It runs but breaks, and Task Scheduler reports an 0xE0434352 error. I've retrieved this error message by catching the exception: Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 8000401a The server process could not be started because the configured identity is incorrect. Check the username and password. (Exception from HRESULT: 0x8000401A).

Task Scheduler says it is running as DOMAIN\Administrator, and that's the account I log in with when I can successfully run the executable. I have it set to run whether I'm logged in or not and with the highest privileges.

It looks to me like somehow Task Scheduler doesn't have the password or permissions it needs to do the Office Interop stuff. But, obviously my understanding is insufficient. Any ideas?

erosebe
  • 927
  • 3
  • 16
  • 31
  • See @VikramGharge's answer here: http://stackoverflow.com/questions/13890906/retrieving-the-com-class-factory-for-component-with-clsid-000209ff-0000-0000-c0 - instead of `Network Service`, use `domain\administrator` (or whatever account the app's running under). – JohnLBevan Nov 13 '14 at 23:59
  • I have tried to do this but it has had no effect. I was forced to alter the Default settings because when I customize the Office settings in Component services they revert back to "Use Default" for some reason. – erosebe Nov 14 '14 at 16:55

1 Answers1

0

I had to change a setting for Office in Component Services. I set it to run as the Launching user instead of an interactive user.

erosebe
  • 927
  • 3
  • 16
  • 31