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

VBS and DFS

Status
Not open for further replies.

linmatt

Technical User
May 22, 2002
50
0
0
GB
Hi All

For some reason I can't map to a DFS share from a VBS login script. If I use standard UNC paths to a server it works fine but defeats the object of using DFS. I've wondered if it needs a different approach but I don't know that much about VBS - still learnin'! Running AD on 2k Server.

eg: ('DOMAIN' is the domain name and DFS Root)

'K: Departments
If IsMember( "Domain Users" ) Then
Call MapDrive ("K:", "DOMAIN", "Departments")


The mapping bit goes...

If objFileSys.DriveExists(strDrive) = True Then
objWshNetwork.RemoveNetworkDrive strDrive, , True
End If

'Build path to share
strPath = "\\" & strServer & "\" & strShare

End If

strServer = domain/DFS Root
strShare = Share

Has anyone else seen this? It's a new domain and I can't go live untill this is sorted.

Thanks
 
DFS shares are called by simply typing \\Sharename at the run box so I dont understand your need for the strServer variable.

Instead of:

strPath = "\\" & strServer & "\" & strShare

Use:

strPath = "\\" & strShare

try it, let me know how it goes. :)
 
The strServer is there cos I cobbled the script from elsewhere and I'm using the existing variable for the DFS Root share and mapping to a couple of individual links, dependant on which AD group they belong to. I could call it strDFSRoot I suppose.

If I map direct to the server and share the link points to it's fine - but if I map to DFS it fails. There are 2 server shares I do have to map to directly and they're fine.

Might be worth pointing out that the DFS Root is running on the same server as the script.

Many thanks

Matt
 
I map drives to DFS unc paths all the time in numerous locations in my forest. It should just work, post the remainder of the mapping code so we can look at it. Incidently, can you perform the drive mapping using Net use? If not, then something else is wrong. If so, then I would assume a scripting typo of some sort.
 
Found the problem - it was jumping to an error handling routine before the verification that the share exists had had time to complete, put in a small delay loop and it works fine. Thought there had to be summat wrong somewhere, but this is the first time I've got to use DFS in anger, having played with it for a year or so, so I wasn't sure if I was missing something.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top