Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

URGENT! Need a Filesystem VBScript

Avatar of Zorge
Zorge asked on
Visual Basic ClassicVB Script
6 Comments1 Solution1379 ViewsLast Modified:
Hello everyone,

I have quite an urgent issue.
I have a VB Script which contacts DFS and lists the Folders and targets.

So that scripts parses DFS and give out something like this:


\\RUM\BS                       '(1)
\\DFS-1\PUBS                '(2)
\\RUM\PUBS
\\DFS-2\PUBS
\\RUM\BS
\\DFS-4\PUBS
\\RUM\BS\UK
\\dfs-3\london
\\RUM\BS\IRELAND
\\Dfs-2\PUBS
\\RUM\DATA
\\DFS-1\DATA
\\RUM\DATA\AAA\DEPT\Finance\Holland
\\DFS-1\TELEKOM
\\RUM\DATA\AAA\DEPT\Finance\Holland
\\DFS-3\TELEKOM

This is a simple DFS structure. First line is DFS Namespace Server (1), second (2) is the share responsible

I have now the following task.

1) I need to extract from that that script output only the lines starting with "\\RUM\DATA\AAA\DEPT\Finance" and their apropriate shares. So in my case the out put would be something like:

\\RUM\DATA\AAA\DEPT\Finance\Holland
\\DFS-1\TELEKOM
\\RUM\DATA\AAA\DEPT\Finance\Holland
\\DFS-3\TELEKOM

2) Then I need to find out the physical location of the share for, in this case,

\\DFS-1\TELEKOM
\\DFS-3\TELEKOM

*hint one can find out the path for a share by using for example, but I don't get how to find it out in VBScript

C:\install>rmtshare \\dfs-3\telekom
Share name        \\dfs-3\telekom
Path              C:\Zimbabwe\TELEKOM
Remark
Maximum users     No limit
Users             0
Permissions:
        \Everyone  :  READ

The command completed successfully.


So that at the end I have something like results like (which are just pathe's of the two shares mentioned above":

DFS-1 C:\Zimbabwe\TELEKOM
DFS-3 C:\Directory\TELEKOM

Remarks:
the output from the script can be much much longer. But the order is always the same.DFS Namespace Server (1), second (2) is the share responsible

Help greatly appreaciated! Thanks!
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colDfsTargets = objWMIService.ExecQuery _
    ("Select * from Win32_DFSTarget")
For each objDfsTarget in colDfsTargets
    Wscript.Echo objDfsTarget.LinkName       
    Wscript.Echo chr(92)&chr(92)& objDfsTarget.ServerName & chr(92)& objDfsTarget.ShareName

Next
ASKER CERTIFIED SOLUTION
Avatar of Fry
FryFlag of Australia image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 6 Comments.
See Answers