Solved

Logon Script Map Network Drive

Posted on 2007-04-06
13
4,790 Views
Last Modified: 2008-07-14
I have a Domain Wide logon script defined that does a ton of stuff.  One thing it's supposed to do is connect the user to our public share, P: using similar code to this:

Dim objNetwork
Set objNetwork = WScript.CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "P:", "\\server\public"
Set objNetwork = Nothing

I'm not getting any errors reported by the script... but for some reason, some users just don't see the public drive letter appear.  Any ideas?
0
Comment
Question by:netsmithcentral
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 6
13 Comments
 
LVL 67

Expert Comment

by:sirbounty
ID: 18866274
Nothing there that would prevent it.
Do they have permissions to that share?
Can you manually map from a command line
net use p: \\server\public
from their workstation?
0
 
LVL 12

Author Comment

by:netsmithcentral
ID: 18866290
They do have permissions, in fact, if I use the GUI (explorer), I can map the drive manually AFTER the script is done running.  The problem is... the script is supposed to do it.
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18866302
Only thing I could think of then is if P is already mapped somehow - are you testing for this in your script somewhere?
0
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
LVL 12

Author Comment

by:netsmithcentral
ID: 18866331
P: "shouldn't" be mapped.... it's far enough from the default drive letters that I'm confident it's not taken an onboard device.  This is the only network mapping it should have.  As for checking for it, I don't know how to do that?  Can it be done with WSH/VB?

Another note, if I physically reexecute the script after the initial logon on a user who isn't mapping P properly, it works perfectly.... that is, P maps.
0
 
LVL 30

Expert Comment

by:LauraEHunterMVP
ID: 18866349
You don't have "On Error Resume Next" specified in the script, do you?  This would prevent any script errors from displaying to the user.
0
 
LVL 12

Author Comment

by:netsmithcentral
ID: 18866410
It is in the script, but I've put an On Error Goto 0 right before the drive mapping to make sure. So more accurately, my script is:

On Error Goto 0
Dim objNetwork
Set objNetwork = WScript.CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "P:", "\\server\public"
Set objNetwork = Nothing
On Error Resume Next
0
 
LVL 67

Accepted Solution

by:
sirbounty earned 500 total points
ID: 18866453
Something like this...

On Error Resume Next
strDriveLetter="P:"
strRemotePath="\\server\public"
Set CheckDrive = objNetwork.EnumNetworkDrives()
AlreadyConnected = False
For intDrive = 0 To CheckDrive.Count - 1 Step 2
  If CheckDrive.Item(intDrive) = strDriveLetter Then AlreadyConnected =True
Next

If AlreadyConnected = True then
objNetwork.RemoveNetworkDrive strDriveLetter
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath

ref: http://www.computerperformance.co.uk/Logon/Logon_HomeDirLoop.htm
0
 
LVL 12

Author Comment

by:netsmithcentral
ID: 18867019
Alright, I checked it, the script is NOT reporting that P has been mapped.  Needless to say, I'm pretty baffled by this one.
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18867177
Just curious if this method would work?

Dim objShell:Set objShell=CreateObject("Wscript.Shell")
objShell.Run "net use P: \\server\public"

Does it get mapped using this route?
0
 
LVL 12

Author Comment

by:netsmithcentral
ID: 18867317
Well, I added some checking code to the loop, to see if the drive was mapped immediately after I mapped it... lo and behold, IT WAS.  Now I can't seem to reproduce the original error using any of the original problem accounts.  I'm thinking there must have been some corrupt volume data related to P: that got flushed through the course of my tests, but I'm not sure.

For now, I'll leave this question open for two days just to make sure the problem doesn't suddenly resurface.  If it doesn't, I'll award full points to sirbounty for the helpful examples.
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18867393
Good luck!
0
 
LVL 12

Author Comment

by:netsmithcentral
ID: 18877569
Alright, everything is still running smoothly.  Looks like whatever it was worked itself out.
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18877582
Happy to help - thanx for the grade! :^)
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question