<div class="content" name="DecommissionNtmsMedia" uuid="e6224cd9-4c2d-4552-b278-5e464b12a76a"><p>The DecommissionNtmsMedia method moves media from available
state to <a href="8d988f06-72be-47cf-9e09-9060aa8ed897#gt_d753ed1c-ff6a-4179-81ea-10ba369e1cca" data-linktype="relative-path">decommissioned</a>
state. Media that are decommissioned by the DecommissionNtmsMedia method are
recognized by the server, but decommissioned media does not contain any data
and is never again used. Only media that are in an available state can be
decommissioned.</p><dl>
<dd>
<div><pre> HRESULT DecommissionNtmsMedia(
   [in] LPNTMS_GUID lpMediaId
 );
</pre></div>
</dd></dl><p><b>lpMediaId: </b>A pointer to the medium identifier
of the partition to be decommissioned.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Return value/code</p>
   </th>
   <th>
   <p>Description</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>0x00000000 S_OK</td>
  <td>The call was successful.</td>
 </tr><tr>
  <td>0x80070005 ERROR_ACCESS_DENIED</td>
  <td>Access to the object is denied; other security errors are possible, but indicate a security subsystem error.</td>
 </tr><tr>
  <td>0x80070008 ERROR_NOT_ENOUGH_MEMORY</td>
  <td>An allocation error occurred during processing.</td>
 </tr><tr>
  <td>0x80070057 ERROR_INVALID_PARAMETER</td>
  <td>The parameter is not valid.</td>
 </tr><tr>
  <td>0x800710CC ERROR_INVALID_MEDIA</td>
  <td>The media identifier is not valid.</td>
 </tr><tr>
  <td>0x800710CE ERROR_INVALID_MEDIA_POOL</td>
  <td>The media pool identifier is not valid.</td>
 </tr><tr>
  <td>0x800710D9 ERROR_DATABASE_FAILURE</td>
  <td>The database query or update failed.</td>
 </tr><tr>
  <td>0x8007139F ERROR_INVALID_STATE</td>
  <td>An unexpected state was encountered; might be disabled or offline.</td>
 </tr></tbody></table>
</dd></dl><p>Upon receiving this message, the server MUST verify that <i>lpMediaId</i>
is not NULL. If it is NULL, the server MUST immediately fail the operation and
return ERROR_INVALID_PARAMETER (0x80070057).</p><p>If parameter validation succeeds, the server MUST verify
that the user has the required access rights. If the client does not have the
required access rights, NTMS_MODIFY_ACCESS to the media is denied and the
server MUST return ERROR_ACCESS_DENIED (0x80070005).</p><p>If the client has the required access rights, the server
MUST verify that the media is in the NTMS_PARTSTATE_AVAILABLE state as defined
in <a href="bdf99d44-7849-4a94-93ec-270a3e8c4eb3" data-linktype="relative-path">NtmsPartitionState (section 2.2.4.7)</a>.
If the media is not in an available state, the server MUST return
ERROR_INVALID_STATE (0x8007139F).</p></div>