[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Logon Script Map Network Drive

Posted on 2007-04-06
13
Medium Priority
?
4,792 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
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 
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 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Sometimes people don't understand why download speed shows differently for Windows than Linux.Specially, this article covers and shows the solution for throughput difference for Windows than a Linux machine. For this, I arranged a test scenario.I…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
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…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

656 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