When you use the DFS MMC snap-in, a Domain Root has an icon with two servers, and a Standalone Root has an icon with one server.

I have scripted ViewDFSRoot.bat to determine if a DFS root is a Domain Root or a Standalone Root.

The syntax for using ViewDFSRoot.bat is:

call ViewDFSRoot \\ServerName\ShareName Answer


<b>\\ServerName\ShareName</b> is the <b>DFS</b>Name.

<b>Answer</b>                 is a <a href="/article/jsifaq/jsi-tip-5535-how-can-i-cause-a-called-batch-file-to-return-a-call-directed-environment-variable-.aspx">call directed environment variable</a> that will contain:
                       <b>D</b>  if <b>\\ServerName\ShareName</b> is a <b>Domain Root</b>.
                       <b>S</b>  if <b>\\ServerName\ShareName</b> is a <b>Standalone Root</b>.
                       <b>N</b>  if <b>\\ServerName\ShareName</b> is a not found.
ViewDFSRoot.bat contains:
@echo off
if \{%2\}==\{\} @echo Syntax: ViewDFSRoot DFSName Answer&goto :EOF
set ans=N
for /f "Tokens=*" %%a in ('dfsutil /root:%1 /view^|findstr "Element Domain Standalone"') do (
 set line=%%a
 if "!line:~0,18!" EQU "Element not found." set ans=N
 if "!line:~0,15!" EQU "Standalone Root" set ans=S
 if "!line:~0,11!" EQU "Domain Root" set ans=D
endlocal&set %2=%ans%