DFS and offline users

The current scenario is :
1-DFS is in place to manage folders
2-A user logon script is executed using group policy to map a drive to the DFS root ( net use j: \\DFS ROOT\DFS )

the basic solution works very well but there is an issue when the user is off the network, the scripts gets executed from what you may want to call a cached group policy  , which is eventually causing delyas during startup and performance issues since the DFS Is offline.

My  questions :
1-Are there any better ways to map the DFS to a drive?
2-Is there a way to check if the DFS is contactable before attemtping to mount the drive?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jeremy WeisingerSenior Network Consultant / EngineerCommented:
If you would like to use offline files then you might want to make the drive mapping persistent. That way it doesn't have to try and connect each time the user logs on.


If you don't need to use the files offline then you could use the script below. It should only try and map the drive if it gets a response from the root.

ping -n 1 %_DFSROOT% | findstr TTL= > Nul
If %ERRORLEVEL% EQU 0 (Set _LAN=1) Else (Set _LAN=0)

If %_LAN%==1 (
  net use j: \\DFS ROOT\DFS

Open in new window

RBedewiAuthor Commented:
Many thanks "My Username".

1-Are there any better ways to map the DFS to a drive??

Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

Jeremy WeisingerSenior Network Consultant / EngineerCommented:
Well you could use VBS to connect the mapped drive. I don't know if it will be any better?

What exactly are you looking for? Are we barking up the wrong tree? When do the delays come in? Is it the script taking a long time or is GP processing taking a long time?
Set objNet = WScript.CreateObject("WScript.Network")
objNet.MapNetworkDrive "J:","\\DFS ROOT\DFS",False
'                                            ^
'         "False" means it is not persistant | 
'  Change it to "true" to make it persistant |

Open in new window

RBedewiAuthor Commented:
well basically, we've have noticed that offline computers use cached vbs scripts to connect to the DFS, which delays the computer startup/login for at least a minute. thats something we would like to eliminate.

Secondly, explore better/more efficient/faster ways to connect to the DFS, basically trying enhance startup time and this is one of the areas that can be looked into.
Jeremy WeisingerSenior Network Consultant / EngineerCommented:
Ah, I see. Well if the scripts are giving you trouble why not first test for connectivity to the domain and only then run the rest of the script? Here's some VBS and batch code to test connectivity.
'***VBS code***
Set objShell = WScript.CreateObject("WScript.Shell")
Set objExec = objShell.Exec("ping -n 1 domain.local")
pingResults = LCase(objExec.StdOut.ReadAll)
If InStr(pingResults, "reply from") = 0 Then
End If

::***batch code***
Set _domain=domain.local

ping -n 1 %_domain% | findstr TTL= > Nul
If %ERRORLEVEL% EQU 0 (Set _LAN=1) Else (Set _LAN=0)

If NOT %_LAN%==1 (

Open in new window

RBedewiAuthor Commented:
many thanks and appreciate your help

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jeremy WeisingerSenior Network Consultant / EngineerCommented:
Glad to :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Project Management

From novice to tech pro — start learning today.