<div class="content"><p> </p><p>The NetrDfsRemove2 (Opnum 20) method removes the specified
link or link target.</p><p>The NetrDfsRemove2 method uses the following <span><a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_9c5903c1-1477-4181-b451-3ba1e34a0c0c" data-linktype="relative-path">MIDL</a></span>
syntax.</p><dl>
<dd>
<div><pre> NET_API_STATUS NetrDfsRemove2(
   [in, string] WCHAR* DfsEntryPath,
   [in, string] WCHAR* DcName,
   [in, unique, string] WCHAR* ServerName,
   [in, unique, string] WCHAR* ShareName,
   [in, out, unique] DFSM_ROOT_LIST** ppRootList
 );
</pre></div>
</dd></dl><p><b>DfsEntryPath: </b>The pointer to a <span><a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_0611e93d-f0e7-42ee-a591-d77ebcbb6619" data-linktype="relative-path">DFS link</a></span>
path that contains the name of the DFS link to remove.</p><p><b>DcName: </b>The pointer to a null-terminated <span><a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_c305d0ab-8b94-461a-bd76-13b40cb8c4d8" data-linktype="relative-path">Unicode</a></span>
string. For a <span><a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_133ab305-ad75-4b38-8ec9-40bc0dc3b594" data-linktype="relative-path">domain-based DFS namespace</a></span>,
this string contains the <span><a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_fe6fd875-b30a-44bb-850e-10733990f04c" data-linktype="relative-path">host name</a></span> of the <span><a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_76a05049-3531-4abd-aec8-30e19954b4bd" data-linktype="relative-path">DC</a></span>
to be used by the <span><a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_ac90b498-3ba4-48d6-bcd6-5495f1654671" data-linktype="relative-path">DFS root target</a></span> that
is removing the DFS link. This parameter MAY be a NULL pointer; otherwise, it
MUST be the <span><a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_663cb13a-8b75-477f-b6e1-bea8f2fba64d" data-linktype="relative-path">PDC</a></span> for the <span><a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_b0276eb2-4e65-4cf1-a718-e0920a614aca" data-linktype="relative-path">domain</a></span>
of the <span><a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_6a3f0be9-b9b4-49df-9d1c-a3b89e4e9890" data-linktype="relative-path">DFS namespace</a></span>.<a id="Appendix_A_Target_87"></a><a aria-label="Product behavior note 87" href="3a466440-1ef6-4439-b4e2-be9eaddeb511#Appendix_A_87" data-linktype="relative-path">&lt;87&gt;</a></p><p><b>ServerName: </b>The pointer to a null-terminated
Unicode <span><a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_44e2f830-c28b-41e3-8c3c-d0bb576ed9fb" data-linktype="relative-path">DFS link target</a></span> host
name string. This MUST be a NULL pointer when the link and all of the link
targets are to be removed.</p><p><b>ShareName: </b>The pointer to a null-terminated
Unicode DFS link target <span><a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_3c179f10-1793-4268-96eb-de4d85a32060" data-linktype="relative-path">share name</a></span> string.
This MUST be a NULL pointer when the link and all of the link targets are to be
removed.</p><p><b>ppRootList: </b>On success, returns a list of DFS
root targets in the domain-based DFS namespace that the client will be
responsible for notifying of the change in the DFS namespace. See section <span><a href="64c2d831-1c50-4127-882d-0e5bc7db52e3" data-linktype="relative-path">3.2.4.2.2</a></span>.
This list MAY be empty if the server has performed the notification.<a id="Appendix_A_Target_88"></a><a aria-label="Product behavior note 88" href="3a466440-1ef6-4439-b4e2-be9eaddeb511#Appendix_A_88" data-linktype="relative-path">&lt;88&gt;</a></p><p><b>Return Values: </b>The method MUST return 0 on
success and a nonzero error code on failure. The method can return any specific
error code value, as specified 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/18d8fbe8-a967-4f1c-ae50-99ca8e491d2d" data-linktype="relative-path">2.2</a></span>.
The most common error codes are listed in the following table.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Return value/code</p>
   </th>
   <th>
   <p>Description</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>0x00000000</p>
  <p>ERROR_SUCCESS</p>
  </td>
  <td>
  <p>Successful completion.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00000002</p>
  <p>ERROR_FILE_NOT_FOUND</p>
  </td>
  <td>
  <p>The specified DFS link target was not found as a
  target of the specified DFS link.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00000005</p>
  <p>ERROR_ACCESS_DENIED</p>
  </td>
  <td>
  <p>Permission to perform the operation was denied.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00000057</p>
  <p>ERROR_INVALID_PARAMETER</p>
  </td>
  <td>
  <p>An incorrect parameter was specified.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00000490</p>
  <p>ERROR_NOT_FOUND</p>
  </td>
  <td>
  <p>The specified DFS namespace or DFS link does not
  exist.</p>
  </td>
 </tr></tbody></table>
</dd></dl><p>The server MAY<a id="Appendix_A_Target_89"></a><a aria-label="Product behavior note 89" href="3a466440-1ef6-4439-b4e2-be9eaddeb511#Appendix_A_89" data-linktype="relative-path">&lt;89&gt;</a> implement
this method.</p><p>If the NetrDfsRemove (Opnum 2) method on a server does not
support a domain-based namespace, the server SHOULD support a domain-based
namespace in the NetrDfsRemove2 (Opnum 20) method.<a id="Appendix_A_Target_90"></a><a aria-label="Product behavior note 90" href="3a466440-1ef6-4439-b4e2-be9eaddeb511#Appendix_A_90" data-linktype="relative-path">&lt;90&gt;</a><a id="Appendix_A_Target_91"></a><a aria-label="Product behavior note 91" href="3a466440-1ef6-4439-b4e2-be9eaddeb511#Appendix_A_91" data-linktype="relative-path">&lt;91&gt;</a></p><p>The server MUST verify the existence of the DFS namespace
that the <i>DfsEntryPath</i> parameter specifies. If the namespace does not
exist, the server MUST return ERROR_NOT_FOUND.</p><p>The server MUST verify the existence of the DFS link <i>DfsEntryPath</i>
parameter specifies. If that existence check fails, the server MUST return
ERROR_NOT_FOUND.</p><p>The server MUST verify the existence of the DFS link target
of the DFS link that the <i>ServerName</i> and <i>RootShare</i> parameters
specify. If that existence check fails, the server MUST return
ERROR_FILE_NOT_FOUND.</p><p>If the <i>ServerName</i> and <i>ShareName</i> parameters are
both NULL, the server MUST remove the link and all its link targets. If the <i>ServerName</i>
and <i>ShareName</i> are not NULL, the server MUST remove the specified link
target. If the specific target is the last target of the link, the server MUST
remove the link as well. If only one of <i>ServerName</i> or <i>ShareName</i>
is NULL, the server MUST return ERROR_INVALID_PARAMETER. </p><p>The server MUST update the same fields in the <span><a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_e8de88fd-d760-46fa-ad77-76961fa20aea" data-linktype="relative-path">DFS
metadata</a></span> for a domain-based DFS namespace, as specified in the <span><a href="89a016c8-3484-49e6-bb48-30cdfd5f8f58" data-linktype="relative-path">NetrDfsRemove</a></span>
method.</p><p>The server MUST synchronously update the DFS metadata of a
domain-based DFS namespace.</p><p>If <span><a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_cf94d206-f71c-4ca1-891a-24c83f533e45" data-linktype="relative-path">DFS root scalability mode</a></span>
is not enabled for the domain-based DFS namespace, the server MUST do one of
the following:</p><ul><li><p><span><span> 
</span></span>Notify other DFS root targets of the change in DFS metadata by
asynchronously issuing a <span><a href="7b033d5b-8d26-4931-8b3d-7aa35e441fb0" data-linktype="relative-path">NetrDfsSetInfo</a></span>
method with the <i>Level</i> parameter 101, and with the <b>State</b> field of <span><a href="af9d607e-04e5-4722-8d00-76cf9c7b69f9" data-linktype="relative-path">DFS_INFO_101</a></span>
set to DFS_VOLUME_STATE_RESYNCHRONIZE. The returned <i>ppRootList</i> parameter
MUST be empty.</p>
</li><li><p><span><span> 
</span></span>Perform no notification of the other root targets, returning a
list of DFS root targets to the client in the <i>ppRootList </i> parameter.</p>
</li></ul></div>