<div class="content"><p> </p><p>The SASetAccountInformation method MUST set the <span><a href="efc35aa8-1f40-4609-869a-107dd31bbed0#gt_b505ab37-868d-426c-bb19-af21e675e0b8" data-linktype="relative-path">credentials</a></span>
under which the task MUST run.</p><dl>
<dd>
<div><pre> HRESULT SASetAccountInformation(
   [in, string, unique] SASEC_HANDLE Handle,
   [in, string] const wchar_t* pwszJobName,
   [in, string] const wchar_t* pwszAccount,
   [in, string, unique] const wchar_t* pwszPassword,
   [in] DWORD dwJobFlags
 );
</pre></div>
</dd></dl><p><b>Handle: </b>Pointer to a <span><a href="efc35aa8-1f40-4609-869a-107dd31bbed0#gt_b069acb4-e364-453e-ac83-42d469bb339e" data-linktype="relative-path">Unicode string</a></span> that
MUST specify the server. The client MUST map this string to an <span><a href="efc35aa8-1f40-4609-869a-107dd31bbed0#gt_8a7f6700-8311-45bc-af10-82e10accd331" data-linktype="relative-path">RPC</a></span>
<span><a href="efc35aa8-1f40-4609-869a-107dd31bbed0#gt_44deb72d-c62b-4335-90e4-b9fd4dd782ed" data-linktype="relative-path">binding
handle</a></span>. The server MUST ignore this parameter. For more information,
see <span><a href="https://go.microsoft.com/fwlink/?LinkId=89824" data-linktype="external">[C706]</a></span> sections
4.3.5 and 5.1.5.2.</p><p><b>pwszJobName: </b>Pointer to a string that MUST
specify a <span><a href="efc35aa8-1f40-4609-869a-107dd31bbed0#gt_47930a5a-7518-4801-85b2-05680cf9c57a" data-linktype="relative-path">task name</a></span>, such as
&#34;MyJob.job&#34;.</p><p><b>pwszAccount: </b>Pointer to a string that MUST
specify the account name. This string MAY be expressed either as a UPN in the
form user@domain or as a Security Account Manager (SAM) name in the form
domain\account.</p><p><b>pwszPassword: </b>Pointer to a string that MUST
specify the password for the account. See section <span><a href="5a141af0-ffb1-452e-8739-2dbece0d978e" data-linktype="relative-path">5.1</a></span>.</p><p><b>dwJobFlags: </b>The <b>dwJobFlags</b> field MUST
contain individual bit flags that MUST have one or more of the following
values:</p><dl>
<dd>
<table>
 <tbody><tr>
  <th><p><br/>0</p></th>
  <th><p><br/>1</p></th>
  <th><p><br/>2</p></th>
  <th><p><br/>3</p></th>
  <th><p><br/>4</p></th>
  <th><p><br/>5</p></th>
  <th><p><br/>6</p></th>
  <th><p><br/>7</p></th>
  <th><p><br/>8</p></th>
  <th><p><br/>9</p></th>
  <th><p>1<br/>0</p></th>
  <th><p><br/>1</p></th>
  <th><p><br/>2</p></th>
  <th><p><br/>3</p></th>
  <th><p><br/>4</p></th>
  <th><p><br/>5</p></th>
  <th><p><br/>6</p></th>
  <th><p><br/>7</p></th>
  <th><p><br/>8</p></th>
  <th><p><br/>9</p></th>
  <th><p>2<br/>0</p></th>
  <th><p><br/>1</p></th>
  <th><p><br/>2</p></th>
  <th><p><br/>3</p></th>
  <th><p><br/>4</p></th>
  <th><p><br/>5</p></th>
  <th><p><br/>6</p></th>
  <th><p><br/>7</p></th>
  <th><p><br/>8</p></th>
  <th><p><br/>9</p></th>
  <th><p>3<br/>0</p></th>
  <th><p><br/>1</p></th>
 </tr>
 <tr>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>R L</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
  <td>
  <p>0</p>
  </td>
 </tr>
</tbody></table>
</dd></dl><p> </p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Value</p>
   </th>
   <th>
   <p>Description</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>RL</p>
  <p>TASK_FLAG_RUN_ONLY_IF_LOGGED_ON</p>
  </td>
  <td>
  <p>When set, the task MUST run only if the user specified
  is logged on interactively.</p>
  </td>
 </tr></tbody></table>
</dd>
<dd>
<p>Undefined bits MUST be set to 0
when sent and ignored upon receipt.</p>
</dd></dl><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>.<a id="Appendix_A_Target_52"></a><a aria-label="Product behavior note 52" href="2d1fbbab-fe6c-4ae5-bdf5-41dc526b2439#Appendix_A_52" data-linktype="relative-path">&lt;52&gt;</a></p><p>Upon receipt of the SASetAccountInformation call, the server
MUST:</p><ul><li><p><span><span> 
</span></span>Return E_ACCESSDENIED if the caller does not have write access to
the folder that represents the .JOB <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 E_INVALIDARG if the <i>pwszAccount</i> parameter is NULL.</p>
<p><b>Note</b>  When the
server is passing NULL as a value for this parameter, behavior can change based
on the RPC Runtime Check. See RPC Runtime Check Notes (section <span><a href="535bb46d-f599-4528-9b02-eb2d391fd361" data-linktype="relative-path">3.3</a></span>).</p>
</li><li><p><span><span> 
</span></span>Return the value 0x80070002, the HRESULT form of the Win32 error
ERROR_FILE_NOT_FOUND, if the <i>pwszJobName</i> parameter is not a file name
that is present in the .JOB task store.</p>
</li><li><p><span><span> 
</span></span>Return E_ACCESSDENIED if the caller does not have write access to
the file in the .JOB task store.</p>
</li><li><p><span><span> 
</span></span>Return E_ACCESSDENIED if the caller does not have administrative
privileges on the server.</p>
</li><li><p><span><span> 
</span></span>Return the value 0x8007000D, which is 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_DATA, if the .JOB file is not
syntactically valid (see <span><a href="96446df7-7683-40e0-a713-b01933b93b18" data-linktype="relative-path">.JOB File
Format (section 2.4)</a></span>).<a id="Appendix_A_Target_53"></a><a aria-label="Product behavior note 53" href="2d1fbbab-fe6c-4ae5-bdf5-41dc526b2439#Appendix_A_53" data-linktype="relative-path">&lt;53&gt;</a><a id="Appendix_A_Target_54"></a><a aria-label="Product behavior note 54" href="2d1fbbab-fe6c-4ae5-bdf5-41dc526b2439#Appendix_A_54" data-linktype="relative-path">&lt;54&gt;</a></p>
</li><li><p><span><span> 
</span></span>If the <i>pwszAccount</i> parameter is not an empty string and <i>pwszPassword</i>
is not NULL:</p>
<ul><li><p><span><span>  </span></span>Return
E_ACCESSDENIED if the <i>pwszPassword</i> parameter is not valid for <i>pwszAccount</i>.<a id="Appendix_A_Target_55"></a><a aria-label="Product behavior note 55" href="2d1fbbab-fe6c-4ae5-bdf5-41dc526b2439#Appendix_A_55" data-linktype="relative-path">&lt;55&gt;</a></p>
</li><li><p><span><span>  </span></span>Update
the account name store by adding a mapping from <i>pwszJobName</i> to <i>pwszAccount</i>.</p>
</li><li><p><span><span>  </span></span>Update
the credential store by adding a mapping from <i>pwszAccount</i> to <i>pwszPassword</i>
if a mapping for <i>pwszAccount</i> is not already present.</p>
</li></ul></li><li><p><span><span> 
</span></span>If the <i>pwszAccount</i> parameter is not an empty string and <i>pwszPassword</i>
is NULL:</p>
<ul><li><p><span><span>  </span></span>Return
SCHED_E_UNSUPPORTED_ACCOUNT_OPTION if the TASK_FLAG_RUN_ONLY_IF_LOGGED_ON bit
in <i>dwJobFlags</i> is not set.<a id="Appendix_A_Target_56"></a><a aria-label="Product behavior note 56" href="2d1fbbab-fe6c-4ae5-bdf5-41dc526b2439#Appendix_A_56" data-linktype="relative-path">&lt;56&gt;</a></p>
</li><li><p><span><span>  </span></span>Update
the account name store by adding a mapping from <i>pwszJobName</i> to <i>pwszAccount</i>.</p>
</li></ul></li><li><p><span><span> 
</span></span>Finally, if the <i>pwszAccount</i> parameter is the empty string:</p>
<ul><li><p><span><span>  </span></span>Return
E_ACCESSDENIED if the caller does not have administrative privileges on the
server.<a id="Appendix_A_Target_57"></a><a aria-label="Product behavior note 57" href="2d1fbbab-fe6c-4ae5-bdf5-41dc526b2439#Appendix_A_57" data-linktype="relative-path">&lt;57&gt;</a></p>
</li><li><p><span><span>  </span></span>If <i>pwszPassword</i>
is not NULL, return E_ACCESSDENIED.<a id="Appendix_A_Target_58"></a><a aria-label="Product behavior note 58" href="2d1fbbab-fe6c-4ae5-bdf5-41dc526b2439#Appendix_A_58" data-linktype="relative-path">&lt;58&gt;</a></p>
</li><li><p><span><span>  </span></span>If <i>pwszPassword</i>
is NULL, update the account name store by adding a mapping from <i>pwszJobName</i>
to &#34;LocalSystem&#34; and return S_OK.</p>
</li><li><p><span><span>  </span></span>Return
SCHED_E_INVALIDVALUE if the <b>MinutesInterval</b> field is set to a value
larger than the <b>MinutesDuration</b> field.<a id="Appendix_A_Target_59"></a><a aria-label="Product behavior note 59" href="2d1fbbab-fe6c-4ae5-bdf5-41dc526b2439#Appendix_A_59" data-linktype="relative-path">&lt;59&gt;</a></p>
</li><li><p><span><span>  </span></span>Return
SCHED_E_UNEXPECTEDNODE if <span><a href="b395602d-839e-4564-a864-60837903143e" data-linktype="relative-path">Trigger type</a></span> is not
as specified in 2.4.2.11.1.<a id="Appendix_A_Target_60"></a><a aria-label="Product behavior note 60" href="2d1fbbab-fe6c-4ae5-bdf5-41dc526b2439#Appendix_A_60" data-linktype="relative-path">&lt;60&gt;</a></p>
</li><li><p><span><span>  </span></span>Return
S_OK on success.</p>
</li></ul><p>If any errors are raised during
the processing, they are returned. For more information about return codes, see
section 2.3.14 and Win32 Error Codes in [MS-ERREF] section 2.1.</p>
</li></ul></div>