<div class="content" name="R_QMMgmtAction" uuid="aef8357a-d84c-4d40-bd3b-9f463bad5025"><p>The R_QMMgmtAction method requests the server to perform a
management function on a specific <a href="a59a1c97-3eea-4af5-b31d-937739889af4#gt_c1a6400d-703b-4f9a-a74c-40f1487978d9" data-linktype="relative-path">queue</a> or <a href="a59a1c97-3eea-4af5-b31d-937739889af4#gt_70ce3665-ae64-44b4-88fe-7c1dcdcd5417" data-linktype="relative-path">MSMQ</a> installation.</p><dl>
<dd>
<div><pre> HRESULT R_QMMgmtAction(
     [in] handle_t hBind,
     [in] const MGMT_OBJECT* pObjectFormat,
     [in] const wchar_t * lpwszAction
     );
</pre></div>
</dd></dl><p><b>hBind: </b>An <a href="a59a1c97-3eea-4af5-b31d-937739889af4#gt_8a7f6700-8311-45bc-af10-82e10accd331" data-linktype="relative-path">RPC</a> binding <a href="a59a1c97-3eea-4af5-b31d-937739889af4#gt_5044babb-08e3-4bb9-bc12-fe8f542b05ee" data-linktype="relative-path">handle</a>, as specified in <a href="../ms-rpce/290c38b1-92fe-4229-91e6-4fc376610c15" data-linktype="relative-path">[MS-RPCE]</a>
section <a href="../ms-mqmq/49b6535b-a8c3-418e-b73f-cacfda9a1d5c" data-linktype="relative-path">2</a>.</p><p><b>pObjectFormat: </b>A pointer to a <a href="818a8e35-b3b5-42e0-95bf-bd851b30edd8" data-linktype="relative-path">MGMT_OBJECT</a> structure that
specifies the queue or computer to which the action is being applied.</p><p><b>lpwszAction: </b> A pointer to a null-terminated
Unicode string that specifies the action to perform on the computer. The <i>lpwszAction</i>
value MUST be one of the following (the value is not case-sensitive).</p><table><thead>
  <tr>
   <th>
   <p>Value</p>
   </th>
   <th>
   <p>Meaning</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>&#34;CONNECT&#34;</td>
  <td>A machine action. Connects the computer to the network and the MSMQ Directory Service server.</td>
 </tr><tr>
  <td>&#34;DISCONNECT&#34;</td>
  <td>A machine action. Disconnects the computer from the network and the MSMQ Directory Service server.</td>
 </tr><tr>
  <td>&#34;TIDY&#34;</td>
  <td>A machine action. Cleans up empty message files. MSMQ does this every 6 hours. It is helpful when a large number of messages are deleted (purged or received by an application), and the application needs the disk space immediately.</td>
 </tr><tr>
  <td>&#34;PAUSE&#34;</td>
  <td>A queue action. Valid for outgoing queues only. Stops the sending of messages from the computer. The queue manager will not send messages to the applicable destination queue until a RESUME action is initiated.</td>
 </tr><tr>
  <td>&#34;RESUME&#34;</td>
  <td>A queue action. Valid for outgoing queues only. Restarts the sending of messages after a PAUSE action is initiated.</td>
 </tr><tr>
  <td>&#34;EOD_RESEND&#34;</td>
  <td>A queue action. Resends the pending transaction sequence.</td>
 </tr></tbody></table><p><b>Return Values: </b>On success, this method MUST return
MQ_OK (0x00000000).</p><p><b>MQ_OK</b> (0x00000000)</p><p><b>MQ_ERROR</b> (0xC00E0001)</p><p>Exceptions Thrown: No exceptions are thrown beyond those
thrown by the underlying RPC protocol, as specified in [MS-RPCE].</p><p>If <i>pObjectFormat</i> specifies an <a href="ec16ac58-40a8-4253-a746-86198d8dafc1" data-linktype="relative-path">MgmtObjectType</a> of
MGMT_SESSION or an <i>lpwszAction</i> has different value than those in the
table above, the call MUST fail and the error message MAY be
MQ_ERROR_INVALID_PARAMETER (0xC00E0006).<a id="Appendix_A_Target_17"></a><a aria-label="Product behavior note 17" href="47ca62cf-676e-4d68-841f-9b936124e75e#Appendix_A_17" data-linktype="relative-path">&lt;17&gt;</a></p><p>If an error occurs, the server MUST return a failure
HRESULT.</p><p>The <a href="a59a1c97-3eea-4af5-b31d-937739889af4#gt_e127848e-c66d-427d-b3aa-9f904fa4ada7" data-linktype="relative-path">opnum</a>
field value for this method MUST be 1 and is received at a dynamically assigned
<a href="a59a1c97-3eea-4af5-b31d-937739889af4#gt_b91c1e27-e8e0-499b-8c65-738006af72ee" data-linktype="relative-path">endpoint</a> supplied by the
RPC endpoint mapper, as specified in [MS-RPCE].</p><p>For MSMQ error codes, see <a href="https://go.microsoft.com/fwlink/?LinkId=90044" data-linktype="external">[MSDN-MQEIC]</a>. The
structure and sequence of data on the wire are specified in the Transfer Syntax
NDR section in <a href="https://go.microsoft.com/fwlink/?LinkId=89824" data-linktype="external">[C706]</a>.</p><p>While processing this call, the server MUST use the <a href="../ms-mqdmpr/9adb2d90-c63b-43c7-9b9c-804ab96a57d5" data-linktype="relative-path">QueueManager</a>
and <a href="../ms-mqdmpr/2e026a09-999e-478f-8c4c-5344b661e579" data-linktype="relative-path">Queue</a>
data elements as specified in <a href="../ms-mqdmpr/5eafe0a6-a22f-436b-a0d9-4cbc25c52b47" data-linktype="relative-path">[MS-MQDMPR]</a>
sections 3.1.1.1 and 3.1.1.2.</p><p> While processing this call, the server MUST generate the
following events specified in [MS-MQDMPR]:</p><ul><li><p><span><span> 
</span></span><a href="../ms-mqdmpr/f8539502-ed84-4cdb-97e7-a8927c97fbbf" data-linktype="relative-path">Bring
Online (section 3.1.4.13)</a></p>
</li><li><p><span><span> 
</span></span><a href="../ms-mqdmpr/3f4f55d3-aa90-41fb-985d-288fd76b2703" data-linktype="relative-path">Take
Offline (section 3.1.4.12)</a></p>
</li><li><p><span><span> 
</span></span><a href="../ms-mqdmpr/19d74159-1a11-4486-8e9d-c54cebfe1088" data-linktype="relative-path">Purge
Queue (section 3.1.7.1.7)</a></p>
</li><li><p><span><span> 
</span></span><a href="../ms-mqdmpr/0711b1af-43b1-44e5-a189-d935cbaac511" data-linktype="relative-path">Pause
Queue (section 3.1.7.2.3)</a></p>
</li><li><p><span><span> 
</span></span><a href="../ms-mqdmpr/d2d2229a-d7b2-4671-bf1d-2e5a14f2f147" data-linktype="relative-path">Resume
Queue (section 3.1.7.2.4)</a></p>
</li></ul><p> The above-described data elements and events MUST be used
as follows:</p><ul><li><p><span><span> 
</span></span>If <i>lpwszAction</i> EQUALS &#34;CONNECT&#34; then generate
the <b>Bring Online</b> event.</p>
</li><li><p><span><span> 
</span></span>If <i>lpwszAction</i> EQUALS &#34;DISCONNECT&#34; then generate
the <b>Take Offline</b> event.</p>
</li><li><p><span><span> 
</span></span>If <i>lpwszAction</i> EQUALS &#34;TIDY&#34; then for each Queue
in <b>QueueManager.QueueCollection</b>, generate the <b>Purge Queue</b> event
with following inputs:</p>
<ul><li><p><span><span>  </span></span>IQueue
: = reference to a <b>Queue</b> specified by element from <b>QueueManager.QueueCollection</b>.</p>
</li></ul></li><li><p><span><span> 
</span></span>If <i>lpwszAction</i> EQUALS &#34;PAUSE&#34; then generate a <b>Pause
Queue</b> event with following inputs:</p>
<ul><li><p><span><span>  </span></span>IQueue
: = reference to a <b>Queue</b> specified by <i>pQueueFormat</i> from <i>pObjectFormat</i>.</p>
</li></ul></li><li><p><span><span> 
</span></span>If <i>lpwszAction</i> EQUALS &#34;RESUME&#34; then generate a <b>Resume
Queue</b> event with following inputs:</p>
<ul><li><p><span><span>  </span></span>IQueue
: = reference to a <b>Queue</b> specified by <i>pQueueFormat</i> from <i>pObjectFormat</i>.</p>
</li></ul></li><li><p><span><span> 
</span></span>If <i>lpwszAction</i> EQUALS &#34;EOD_RESEND&#34; then generate
a <b>Resend Transactional Sequence</b> event with following inputs:</p>
<ul><li><p><span><span>  </span></span>IQueue
: = reference to a <b>Queue</b> specified by <i>pQueueFormat</i> from <i>pObjectFormat</i>.</p>
</li></ul></li></ul></div>