title: Get DFS folder target (local server path) from a DFS path in C#
body: <p>I have a DFS folder path...</p>
  
  <pre><code>\\domain.name\SharesRoot\DFSShare
  </code></pre>
  
  <p>I need to get the actual folder target of this root link or in other words the local server path that DFSShare is targetting</p>
  
  <p>The local server path/folder target is as follows</p>
  
  <pre><code>\\MyServer\Share\MyShare
  </code></pre>
  
  <p>I've successfully used the <a href="https://msdn.microsoft.com/en-us/library/bb524810(v=vs.85).aspx" rel="nofollow noreferrer">NetDfsGetClientInfo()</a> method to retrieve SOME of the needed information from the given DFS path</p>
  
  <p>The DFS_STORAGE_INFO object that this method populates gives me the following data</p>
  
  <ul>
  <li>State: <em>irrelevant data</em></li>
  <li>ServerName: 'MyServer'</li>
  <li>ShareName: 'SharesRoot'</li>
  </ul>
  
  <p>While the ServerName is what I'm looking for, the ShareName does not help me at all.</p>
  
  <p><strong>I need to find out what the path is on</strong> <code>MyServer</code> <strong>that the DFS path</strong> <code>\\domain.name\SharesRoot\DFSShare</code> <strong>is targetting</strong></p>
  
  <p><a href="https://msdn.microsoft.com/en-us/library/bb524812(v=vs.85).aspx" rel="nofollow noreferrer">NetDfsGetInfo()</a> gives me 1168 error, so that method is not helping, and I'm yet to try <a href="https://msdn.microsoft.com/en-us/library/bb524809(v=vs.85).aspx" rel="nofollow noreferrer">NetDfsEnum()</a>, however my hopes aren't high seeing as it populates the same structs as the <a href="https://msdn.microsoft.com/en-us/library/bb524810(v=vs.85).aspx" rel="nofollow noreferrer">NetDfsGetClientInfo()</a>... if anyone has any other leads here I'd be incredibly grateful!</p>