<div class="content"><p> </p><p>The SchRpcGetLastRunInfo method MUST return information
about the task&#39;s last run.</p><dl>
<dd>
<div><pre> HRESULT SchRpcGetLastRunInfo(
   [in, string] const wchar_t* path,
   [out] PSYSTEMTIME pLastRuntime,
   [out] DWORD* pLastReturnCode
 );
</pre></div>
</dd></dl><p><b>path: </b>MUST contain the full path to a task
using the format specified in section <span><a href="fa8809c8-4f0f-4c6d-994a-6c10308757c1" data-linktype="relative-path">2.3.11</a></span>.</p><p><b>pLastRuntime: </b>The server MUST return an error
if this parameter is NULL. The server MUST return the time when the task last
started running, or zero if the task has never started.</p><p><b>pLastReturnCode: </b>The server MUST return an
error if this parameter is NULL. The server MUST return the exit code from the
task&#39;s last execution, or zero if the task has never finished execution.</p><p><b>Return Values: </b>For more information about
return codes, see section <span><a href="774cd43a-8376-4c8b-a2e3-57aaa6357088" data-linktype="relative-path">2.3.14</a></span>, or Win32
Error Codes in <span><a href="../ms-erref/1bc92ddf-b79e-413c-bbaa-99a5281a6c90" data-linktype="relative-path">[MS-ERREF]</a></span>
section <span><a href="../ms-erref/0642cb2f-2075-4469-918c-4441e69c548a" data-linktype="relative-path">2.1</a></span>.</p><p>Upon receipt of the SchRpcGetLastRunInfo call that requires
the server to return the info of the last instance of a task, the server MUST:</p><ul><li><p><span><span> 
</span></span>Return E_INVALIDARG if any of the following statements are true:</p>
<ul><li><p><span><span>  </span></span>The
<i>path</i> parameter is NULL.</p>
<p>The <i>pLastRuntime</i>
parameter is NULL.</p>
<p>The <i>pLastReturnCode</i>
parameter is NULL.</p>
</li></ul><p><b>Note</b>  When
passing NULL as a value for parameters, behavior can change based on the RPC
Runtime Check. See <span><a href="535bb46d-f599-4528-9b02-eb2d391fd361" data-linktype="relative-path">RPC Runtime Check Notes</a></span>
(section 3.3).</p>
</li><li><p><span><span> 
</span></span>Return the value 0x8007007B, the <span><a href="../ms-dtyp/a9046ed2-bfb2-4d56-a719-2824afce59ac" data-linktype="relative-path">HRESULT</a></span>
form of the Win32 error ERROR_INVALID_NAME, if the specified <i>path</i> is not
in the format specified in section 2.3.11.</p>
</li><li><p><span><span> 
</span></span>Return the value 0x80070003, the HRESULT form of the Win32 error
ERROR_PATH_NOT_FOUND, if the specified <i>path</i> does not exist on the server
in the <span><a href="efc35aa8-1f40-4609-869a-107dd31bbed0#gt_982b7f8e-d516-4fd5-8d5e-1a836081ed85" data-linktype="relative-path">XML</a></span> <span><a href="efc35aa8-1f40-4609-869a-107dd31bbed0#gt_08035fe7-a786-4b30-ab60-3fd046060617" data-linktype="relative-path">task
store</a></span>.</p>
</li><li><p><span><span> 
</span></span>Return the HRESULT form of the Win32 error ERROR_FILE_NOT_FOUND
if the  specified task does not exist on the server in the XML task store.</p>
</li><li><p><span><span> 
</span></span>Return E_ACCESSDENIED if the caller does not have read access to
the task.</p>
</li><li><p><span><span> 
</span></span>Retrieve the last runtime and exit code associated with the task
in the task store, and:</p>
<ul><li><p><span><span>  </span></span>Return
the last runtime in the <i>pLastRuntime</i> parameter.</p>
</li><li><p><span><span>  </span></span>Return
the exit code in the <i>pLastReturnCode</i> parameter.</p>
</li></ul></li><li><p><span><span> 
</span></span>Return S_OK.</p>
</li></ul></div>