<div class="content" name="Search" uuid="8bc81f1d-0491-463c-a347-a4486b7d83ab"><p>The IUpdateSearcher::Search (opnum 20) method performs an
update search.</p><dl>
<dd>
<div><pre> HRESULT Search(
   [in] BSTR criteria,
   [out, retval] ISearchResult** retval
 );
</pre></div>
</dd></dl><p><b>criteria: </b>A string specifying criteria that
updates are required to meet in order to be returned in the search results.</p><dl>
<dd>
<p>The server MUST support criteria specified by the
following ABNF grammar.</p>
<dl>
<dd>
<div><pre>  
 criteria = andgroup *[1,*WSP &#34;or&#34; 1,*WSP andgroup] /
  
 andgroup = andgroup *[1,*WSP &#34;and&#34; 1,*WSP andgroup] / &#34;(&#34; *WSP andgroup *WSP &#34;)&#34; / criterion
  
 criterion = propertyname *WSP operator *WSP value / &#34;(&#34; *WSP criterion *WSP &#34;)&#34;
  
 propertyname = &#34;Type&#34; / &#34;DeploymentAction&#34; / &#34;IsAssigned&#34; / 
    &#34;AutoSelectOnWebSites&#34; / &#34;BrowseOnly&#34; / &#34;UpdateID&#34; / &#34;RevisionNumber&#34; /
    &#34;CategoryIDs&#34; / &#34;IsInstalled&#34; / &#34;IsHidden&#34; /  &#34;IsPresent&#34; /
    &#34;RebootRequired&#34;
  
 operator = &#34;=&#34; / &#34;!=&#34; / &#34;contains&#34;
  
 value = string / integer
  
 string = &#34;&#39;&#34; *CHAR &#34;&#39;&#34;
  
 integer = [&#34;-&#34;] 1*DIGIT
</pre></div>
</dd></dl></dd>
<dd>
<p>The CHAR and DIGIT production
rules are specified in <span><a href="https://go.microsoft.com/fwlink/?LinkId=123096" data-linktype="external">[RFC5234]</a></span>
section B.1.</p>
</dd>
<dd>
<p>Integer values MUST be specified
in base 10. String values MUST be escaped (using the
IUpdateSearcher::EscapeString (opnum 18) method) before being enclosed in
single quotation marks, as specified by the preceding grammar. String
comparisons MUST be case-insensitive.</p>
</dd>
<dd>
<p>The server MUST support the
following update properties with the given operators and value types.</p>
</dd>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Update property name</p>
   </th>
   <th>
   <p>Operators supported</p>
   </th>
   <th>
   <p>Value type</p>
   </th>
   <th>
   <p>Description</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>Type</td>
  <td>=, !=</td>
  <td>String</td>
  <td>Compares the update&#39;s type to that given.</td>
 </tr><tr>
  <td>DeploymentAction</td>
  <td>=</td>
  <td>String</td>
  <td>Finds updates with the given deployment action. If this criterion is not specified, the search operation MUST return only updates with a DeploymentAction of &#34;Installation&#34;.</td>
 </tr><tr>
  <td>IsAssigned</td>
  <td>=</td>
  <td>Integer MUST be 0 or 1</td>
  <td>The value is treated as a Boolean. The value determines whether the search operation finds updates that are intended for processing by an automatic update agent.</td>
 </tr><tr>
  <td>AutoSelectOnWebsites</td>
  <td>=</td>
  <td>Integer MUST be 0 or 1</td>
  <td>The value is treated as a Boolean. The value determines whether the search operation finds updates that are intended to be automatically selected from web user interfaces.</td>
 </tr><tr>
  <td>BrowseOnly</td>
  <td>=</td>
  <td>Integer MUST be 0 or 1</td>
  <td>The value is treated as a Boolean. The value determines whether the search operation finds updates that are not intended for processing by an automatic update agent.</td>
 </tr><tr>
  <td>UpdateID</td>
  <td>=, !=</td>
  <td>String</td>
  <td>Compares the update&#39;s ID to that given.</td>
 </tr><tr>
  <td>RevisionNumber</td>
  <td>=</td>
  <td>Integer</td>
  <td>Finds updates with the given revision number.</td>
 </tr><tr>
  <td>CategoryIDs</td>
  <td>Contains</td>
  <td>String</td>
  <td>Finds updates belonging to the given category.</td>
 </tr><tr>
  <td>IsInstalled</td>
  <td>=</td>
  <td>Integer MUST be 0 or 1</td>
  <td>The value is treated as a Boolean. The value determines whether the search operation finds updates that are installed.</td>
 </tr><tr>
  <td>IsHidden</td>
  <td>=</td>
  <td>Integer MUST be 0 or 1</td>
  <td>The value is treated as a Boolean. The value determines whether the search operation finds updates that have been hidden by a user.</td>
 </tr><tr>
  <td>IsPresent</td>
  <td>=</td>
  <td>Integer MUST be 0 or 1</td>
  <td>The value is treated as a Boolean. The value determines whether the search operation finds updates that are present, that is, updates that have been installed for one or more products.</td>
 </tr><tr>
  <td>RebootRequired</td>
  <td>=</td>
  <td>Integer MUST be 0 or 1</td>
  <td>The value is treated as a Boolean. The value determines whether the search operation finds updates that currently require a reboot to complete installation or uninstallation.</td>
 </tr></tbody></table>
</dd></dl><p><b>retval: </b>An <b>ISearchResult</b> instance with
the results of the search.</p><p><b>Return Values: </b>The method MUST return
information in an <b>HRESULT</b> data structure. The severity bit in the
structure identifies the following conditions:</p><ul><li><p><span><span>  </span></span>If
the severity bit is set to 0, the method completed successfully.</p>
</li><li><p><span><span>  </span></span>If
the severity bit is set to 1, the method failed and encountered a fatal error.</p>
</li></ul><dl>
<dd>
<p>If the criteria string cannot be
parsed by the search criteria grammar specified preceding, the method MUST
return an error.</p>
</dd></dl><p><b>Exceptions Thrown:</b> No exceptions are thrown beyond
those thrown by the underlying RPC protocol <span><a href="../ms-rpce/290c38b1-92fe-4229-91e6-4fc376610c15" data-linktype="relative-path">[MS-RPCE]</a></span>.</p><p>The server SHOULD trigger the <span><a href="750e8355-177c-4a51-bab8-927c813819c8#gt_362092cf-7fb5-43eb-92e1-c3e4affdd92b" data-linktype="relative-path">update agent</a></span> to
perform an update search through an implementation-dependent<a id="Appendix_A_Target_41"></a><a aria-label="Product behavior note 41" href="50faf1ae-d0ab-42cb-87e2-33f30391e807#Appendix_A_41" data-linktype="relative-path">&lt;41&gt;</a> interface.</p><p>The update search MUST be restricted to updates meeting the <i>criteria</i>
specified. If the <i>criteria</i> parameter is NULL or the empty string, the
server SHOULD trigger the update agent to use default search criteria, as
defined by the update agent.</p><p>If the value of the <b>CanAutomaticallyUpgradeService</b>
ADM element is VARIANT_TRUE, the search operation MAY automatically upgrade the
update agent.</p><p>If the value of the <b>IncludePotentiallySupersededUpdates</b>
ADM element is VARIANT_TRUE, the search operation results SHOULD include
updates superseded by other updates in the search results. Otherwise, the
search operation results SHOULD NOT include updates superseded by other updates
in the search results.</p><p>If the value of the <b>Online</b> ADM element is VARIANT_TRUE,
the search operation SHOULD go online.</p><p>The following table specifies the update server against
which the search operation SHOULD be performed.</p><table><thead>
  <tr>
   <th>
   <p>Value of the ServerSelection ADM element</p>
   </th>
   <th>
   <p>Update server to search against</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>ssDefault</td>
  <td>Implementation-defined by the update agent.</td>
 </tr><tr>
  <td>ssManagedServer</td>
  <td>An update server managed by an administrator.</td>
 </tr><tr>
  <td>ssWindowsUpdate</td>
  <td>The Windows Update update server</td>
 </tr><tr>
  <td>ssOthers</td>
  <td>The update server identified by the value of the ServiceID ADM element.</td>
 </tr></tbody></table><p>If the value of the <b>IgnoreDownloadPriority</b> ADM
element is VARIANT_TRUE, the search operation SHOULD ignore the download
priority of updates when computing update supersedence.</p><p>The following table specifies the set of updates for which
the search operation SHOULD be performed.</p><table><thead>
  <tr>
   <th>
   <p>Value of the SearchScope ADM element</p>
   </th>
   <th>
   <p>Updates to search for</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>searchScopeDefault</td>
  <td>Per-machine updates only.</td>
 </tr><tr>
  <td>searchScopeMachineOnly</td>
  <td>Per-machine updates only.</td>
 </tr><tr>
  <td>searchScopeCurrentUserOnly</td>
  <td>Per-user updates for the calling user only.</td>
 </tr><tr>
  <td>searchScopeMachineAndCurrentUser</td>
  <td>Per-machine updates and per-user updates for the calling user.</td>
 </tr><tr>
  <td>searchScopeMachineAndAllUsers</td>
  <td>Per-machine updates and per-user updates for all users.</td>
 </tr><tr>
  <td>searchScopeAllUsers</td>
  <td>Per-user updates for all users.</td>
 </tr></tbody></table><p> </p></div>