Solved

Network drive mapped but not showing the name.  ODD

Posted on 2011-09-02
4
382 Views
Last Modified: 2012-08-14
hello I am having one of the oddest issues with mapping network drives.  On some of our computers xp and vista.  I have an active directory server that runs a bat file to map the network drives when they log in as seen below my question.  But what it does sometimes is it wipes out the info that it shows for the "name"  and calls it Network Name....  how do I fix this issue so it shows the name of the true drive.

Echo off
CLS

ECHO Map Corporate Images Drive
NET USE i: \\hbspectrum\images /PERSISTENT:NO

ECHO Map Corporate Residential Drive
NET USE r: \\hbfipr\public\residential /PERSISTENT:NO

ECHO Map Corporate Residential Drive
NET USE n: \\hbfipr\public\svr /PERSISTENT:NO

ECHO Map Corporate CommSVC Drive
NET USE o: \\hbfipr\public\commsvc /PERSISTENT:NO

ECHO Map Corporate Warehouse Drive
NET USE w: \\hbfipr\public\warehouse /PERSISTENT:NO

ECHO Map Corporate Commercial Drive
NET USE v: \\hbfipr\public\vault /PERSISTENT:NO

ECHO Map Corporate Administration Drive
NET USE m: \\hbfipr\public\admin /PERSISTENT:NO

ECHO Map Corporate NorthBoundary Drive
NET USE p: \\hbnorth\northboundary /PERSISTENT:YES
0
Comment
Question by:HB-IT
  • 3
4 Comments
 
LVL 12

Expert Comment

by:Mike
ID: 36475172
change i, r, n, o, w, v, m, p to Capital Letters just for the heck of it....
0
 
LVL 6

Accepted Solution

by:
joeyfaz earned 500 total points
ID: 36478431
I just made this vb code for you, it should work as needed. Let me know otherwise
Dim i, d, v, m
Dim mDrive(7)

Set oShell = CreateObject("Shell.Application")
Set oNet = CreateObject("WScript.Network")
Set d = oNet.EnumNetworkDrives

'Directions:
'1) Use format: "D: <-Drive letter with colon, \\server\folder <-UNC path, Description <-Don't use commas or any special characters
mDrive(0)="I:,\\server\Share,Map Corporate Images Drive"
mDrive(1)="R:,\\server\Share,Map Corporate Residential Drive"
mDrive(2)="N:,\\server\Share,Map Corporate Residential Drive"
mDrive(3)="O:,\\server\Share,Map Corporate CommSVC Drive"
mDrive(4)="W:,\\server\Share,Map Corporate Warehouse Drive"
mDrive(5)="V:,\\server\Share,Map Corporate Commercial Drive"
mDrive(6)="M:,\\server\Share,Map Corporate Administration Drive"
mDrive(7)="P:,\\server\Share,Map Corporate NorthBoundary Drive"

For i=0 To 7
v=Split(mDrive(i),",")
For m=0 To (d.Count-1) Step 2
'Check if above indicated mapped drives are in use and then remove them
If d.Item(m)=v(0) Then
WScript.Echo d.Item(m) & " = " & v(0) & vbCrLf
oNet.RemoveNetworkDrive v(0)
End If
Next
'Map the drives and then label them
oNet.MapNetworkDrive v(0), v(1)
oShell.NameSpace(v(0)).Self.Name=v(2)
Next

Set oShell=Nothing
Set oNet=Nothing

Open in new window

0
 
LVL 6

Expert Comment

by:joeyfaz
ID: 36478437
Comment out WScript.Echo d.Item(m) & " = " & v(0) & vbCrLf with a ' if you don't want to know which mapped drives were removed
0
 
LVL 6

Expert Comment

by:joeyfaz
ID: 36481821
Copy the code to a text document, change the extension to .vbs and include it as a logon script on the domain.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

On July 14th 2015, Windows Server 2003 will become End of Support, leaving hundreds of thousands of servers around the world that still run this 12 year old operating system vulnerable and potentially out of compliance in many organisations around t…
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

863 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now