×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Using Visio to diagram Distributed file system (DFS)

Using Visio to diagram Distributed file system (DFS)

Using Visio to diagram Distributed file system (DFS)

(OP)

Does anyone know of a tool or product to read DFS from Active Directory and display in Visio?

Guess this would be like the Active Directory Diagraming Tool for AD and Exchange.

Dave

RE: Using Visio to diagram Distributed file system (DFS)

(OP)

Here is a script that reads the Domain name and then gathers information about all the Domain DFS namespaces into one file.

Dave

'***************************************************************************************************************** ** *****
'Written by David
'7 FEB 2008
'
' Reads domain name and gets information about DFS Namespaces
' Uses dfsutil to gather the information from domain
'
'
Option Explicit

Dim netObj, objSysInfo
Dim LocalComputerName, Username, domaindnsname, domainname
Dim testmode, PopMessage
Dim strFolder,strCommand,strProgramName
Dim objshell, objFSO
Dim StartPos, EndPos    'where in the array do the dfs name spaces start and end
Dim loopcounter, strOutput, strOutputFile

Dim arrReadinput()
Dim arrOutput()

Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8


'************************************************************************************************************************
'set memory varibles used by the script
'
Set netobj=wscript.createobject("wscript.network")        'create network object
localcomputername=netobj.computername                'get local computer name
domainname=netobj.userdomain                        'get local domain
username=netobj.username                        'get username
Set objSysInfo = CreateObject("ADSystemInfo")            'create adsi object
domaindnsname = objSysInfo.DomainDNSName                'Domain DNS Name

'************************************************************************************************************************

Set objShell = wscript.createObject("wscript.shell")
Set objFSO = createObject("scripting.filesystemobject")


Call ScriptPath(strFolder,strCommand,strProgramName)


'************************************************************************************************************************
'Main program loop
'
'open output file
strOutput = inputbox("Please enter Output file name", "Output File", strfolder & strProgramName & ".txt")
If strOutput = "" Then
 wscript.quit
End If

If objFSO.FileExists(strOutput) Then
 objFSO.DeleteFile(strOutput)
End If

Set strOutputFile = objfso.opentextfile(strOutput, ForWriting, True)

'write header
strOutputFile.writeline ("Calling Program     : " & strProgramName)
strOutputFile.writeline ("Called from folder  : " & strfolder)
strOutputFile.writeline ("Date of Run         : " & date)
strOutputFile.writeline ("Time of Run         : " & time)
strOutputFile.writeline ("Local Computer Name : " & localcomputername)
strOutputFile.writeline ("Domain Name         : " & domainname)
strOutputFile.writeline ("User Name           : " & username)
strOutputFile.writeline ("Domain DNS Name     : " & domaindnsname)
strOutputFile.writeline()
strOutputFile.close

Set strOutputFile = objfso.opentextfile(strOutput, ForAppending, True)

getDomainDFSNameSpaces(domainname)

For loopcounter = startpos To EndPos
 strOutputFile.write (getNameSpaces(arrReadinput(loopcounter)))
Next

strOutputFile.close

'close object
Set objfso = Nothing
Set objshell = Nothing

wscript.echo "Prgram Complete " & vbCrlf & "output file is located at" & vbCrlf & strfolder & strProgramName & ".txt"
wscript.quit

'************************************************************************************************************************
'end of program Functions and procedures below
'********************************************************************************************
''********************************************************************************************
' Function returns true if lstrcomputer is online, does ping test for reply in console message
Function IsOnline(lstrComputer)
Dim objExecObject, strText
Set objShell = CreateObject("WScript.Shell"):
Set objExecObject = objShell.Exec ("%comspec% /c ping -n 1 -w 25 " & lstrComputer)
Do While Not objExecObject.StdOut.AtEndOfStream
    strText = objExecObject.StdOut.ReadAll()
    If Instr(strText, "Reply") > 0 Then
        IsOnline=True
    Else
        IsOnline=False
    End If
Loop
End Function
'********************************************************************************************

'********************************************************************************************
'This function returns the path from which the script was called
'Call ScriptPath(strFolder,strCommand,strProgramName)
'wscript.echo "Called from folder   : -> " & strFolder & vbCrlf & "Calling Program Line : -> " & strCommand & vbCrlf  _
'& "Calling Program Name : -> " & strProgramName & vbCrlf
'wscript.quit

Function ScriptPath(callingfolder, callingcommandline, callingprogramname)
    ScriptPath=Left(Wscript.scriptfullname,Instr(1,WScript.ScriptFullName,wscript.scriptname,1)-1)
    callingfolder=scriptpath
    callingcommandline=wscript.scriptfullname
    callingprogramname=left(wscript.scriptname,len(wscript.scriptname)-4)
End Function
'*******************************************************************************************
'********************************************************************************************
' Function returns DFS Namespaces in domain
Function getDomainDFSNameSpaces(strDomain)
Dim objExecObject, strText, counter
Set objShell = CreateObject("WScript.Shell")

counter = 0
Set objExecObject = objShell.Exec ("%comspec% /c dfsutil /Domain:\\" & strDomain &  " /view""")


Do While Not objExecObject.StdOut.AtEndOfStream
'    strText = objExecObject.StdOut.ReadAll()
    Redim Preserve arrReadinput(counter)
    'remove tab from line item
    arrReadinput(counter)=replace(objExecObject.StdOut.Readline(),vbTab,"")
    counter=counter+1
'    wscript.echo strText
Loop
    counter=0
    'remove program header lines
    StartPos = lbound(arrReadinput)+7
    'remove program trail lines
    EndPos = ubound(arrReadinput)-4
    'Write output header
    strOutputFile.writeline("********************************************************************************************")

    strOutputFile.writeline("Domain Namespaces For " & strDomain & " as of " & date & vbCrlf)
    'write output string
    For counter = StartPos To EndPos
     strOutputFile.writeline(arrReadinput(counter))
'       counter=counter+1
    Next

End Function
'********************************************************************************************

'********************************************************************************************
' Function returns DFS Namespaces folder targets in domain
Function getNameSpaces(StrNameSpace)
Dim objExecObject, strText, counter
Set objShell = CreateObject("WScript.Shell")

counter = 0
Set objExecObject = objShell.Exec ("%comspec% /c dfsutil /root:\\" & domainname & "\" & StrNameSpace &  " /view""")

Do While Not objExecObject.StdOut.AtEndOfStream
    strText = objExecObject.StdOut.ReadAll()
    counter=counter+1
Loop

strOutputFile.writeline("********************************************************************************************")
strOutputFile.writeline("Namespace For " & StrNameSpace & " as of " & date & vbCrlf)
strOutputFile.writeline(strText)

End Function
'********************************************************************************************
'EOF

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close