Estou tentando iniciar uma tarefa no agendador de tarefas. A tarefa basicamente executará um 'runas / savecred / user: abc job.bat' para iniciar um processo. No entanto, falhou. Eu acho essa mensagem de erro no log de eventos e acho que pode ser relevante.
Log Name: Application
Source: Application Error
Date: 3/10/2015 1:52:39 AM
Event ID: 1000
Task Category: (100)
Level: Error
Keywords: Classic
User: N/A
Computer: WIN-PLMLT7HVCLA
Description:
Faulting application name: cmd.exe, version: 6.2.9200.16384, time stamp: 0x50108a15
Faulting module name: KERNELBASE.dll, version: 6.2.9200.17046, time stamp: 0x53b4864c
Exception code: 0xc0000142
Fault offset: 0x00000000000e2000
Faulting process id: 0x1114
Faulting application start time: 0x01d05ad4e3fc0903
Faulting application path: C:\Windows\system32\cmd.exe
Faulting module path: KERNELBASE.dll
Report Id: 21ad5685-c6c8-11e4-945e-062e57f301ba
Faulting package full name:
Faulting package-relative application ID:
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Application Error" />
<EventID Qualifiers="0">1000</EventID>
<Level>2</Level>
<Task>100</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2015-03-10T01:52:39.000000000Z" />
<EventRecordID>14096</EventRecordID>
<Channel>Application</Channel>
<Computer>WIN-PLMLT7HVCLA</Computer>
<Security />
</System>
<EventData>
<Data>cmd.exe</Data>
<Data>6.2.9200.16384</Data>
<Data>50108a15</Data>
<Data>KERNELBASE.dll</Data>
<Data>6.2.9200.17046</Data>
<Data>53b4864c</Data>
<Data>c0000142</Data>
<Data>00000000000e2000</Data>
<Data>1114</Data>
<Data>01d05ad4e3fc0903</Data>
<Data>C:\Windows\system32\cmd.exe</Data>
<Data>KERNELBASE.dll</Data>
<Data>21ad5685-c6c8-11e4-945e-062e57f301ba</Data>
<Data>
</Data>
<Data>
</Data>
</EventData>
</Event>
Se eu executar runas /savecred /user:abc job.bat
diretamente em um prompt do DOS, ele funcionará sem problemas.
O motivo pelo qual não posso executá-lo como abc
é porque ele usa o objeto COM do MS Office. Quando ele tenta abrir um arquivo de powerpoint, ele lança essa exceção:
Error HRESULT E_FAIL has been returned from a call to a COM component
Existe uma maneira de fazer isso funcionar?