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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

enumerate location of dfs?

Status
Not open for further replies.

AntunB

IS-IT--Management
Aug 11, 2003
263
0
0
AU
hey,

is there a way to enumerate which location the DFS is using?

normally in windows XP you can put in the dfs lecation which is

\\locaion\share
once at that location you can right click a folder, click on DFS tab and it will tell you which server it is using

\\servername

so how would i do this with a script?

Thanks?
 
Ok

DFS is a distributed file system
what that is if you have 2 servers, you can replicate data to both servers and only use 1 location

so if you have \\domain\share
this will point to \\server1\share or \\server2\share so you will get the same data anyways

so what i want to know is if you do use \\domain\share which server would it be pointing to? server1, or server2?

i explained above how you can do it manualy, but i want to be able to do it with a script

Thanks
 
Try this.
[tt]
sdfsnode="\\a0b1c2\xyz" 'your input

set svc=getobject("winmgmts:root\cimv2")
set ctarget=svc.associatorsof("win32_dfsnode='" & sdfsnode & "'", _
"win32_dfsnodetarget","win32_dfstarget","dependent","antecedent")
for each otarget in ctarget
if otarget.status=4 then
wscript.echo _
"active target node of dfsnode '" & sdfsnode & "'" & vbcrlf & _
"name : " & otarget.name & vbcrlf & _
"link name : : & otarget.linkname & vbcrlf & _
"share name : " & otarget.sharename & vbcrlf & _
"server name : " & otarget.servername
exit for
end if
next
set ctarget=nothing
set svc=nothing
[/tt]
- tsuji
 
Ok i am getting this error

Error:0x80041010
Code: 80041010
Source: (null)

on line: "for each otarget in ctarget"


i have tried
sdfsnode="\\server\share"
sdfsnode="\\dfsname\share"
sdfsnode="server"

all the same error

hmm i don't understand, am i doing something wrong?
 
my posting
>[tt]set ctarget=svc.associatorsof("win32_dfsnode='" & sdfsnode & "'", _
> "win32_dfsnodetarget","win32_dfstarget","dependent"[red],"antecedent"[/red])[/tt]
Try again with taking out the last parameter.
[tt]set ctarget=svc.associatorsof("win32_dfsnode='" & sdfsnode & "'", _
"win32_dfsnodetarget","win32_dfstarget","dependent")
[/tt]
- tsuji
ps. To PHV: to answer "here" to your note "there", yes, quite a lot... And you? (no need to answer.)
 
I have overlooked in specifying the name property. Try this instead.
[tt]
set ctarget=svc.associatorsof("win32_dfsnode[red].name[/red]='" & sdfsnode & "'", _
"win32_dfsnodetarget","win32_dfstarget","dependent","antecedent")
[/tt]
If it fails, try escape the sdfsnode, ie replacing [blue]sdfsnode[/blue] by [blue]replace(sdfsnode,"\","\\")[/blue] in the set ctarget line. But I guess no need at the first instance in the situation.

- tsuji
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top