Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Visio to diagram Distributed file system (DFS)

Status
Not open for further replies.

conan3

MIS
May 6, 2003
65
US

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
 

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

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top