Drive mappings being dropped
Author
Discussion

Gaffer

Original Poster:

7,156 posts

307 months

Thursday 23rd February 2006
quotequote all
Can anyone help with this problem please....?

Server 2003

A drive mapping has been created through a logon script from the user profile, but it seems to periodically drop the drive mapping connection.

Its been monitored to see when it drops and so far it seems to happen overnight but has happened during the day on occasion.

The script is as follows:

Set wshNetwork = CreateObject("WScript.Network" )
wshNetwork.MapNetworkDrive "y:", "*****-SERVER Name of Company"

(NB there is a between server and name of company but it wont appear in the post for some reason)

Any advice would be greatly appreciated.

Ta

Claire

Editied as a appeared in the code..!

>> Edited by Gaffer on Thursday 23 February 16:37

neil_cardiff

17,113 posts

294 months

Thursday 23rd February 2006
quotequote all
I don't know about that particular script but this is what I do; it works a treat

' declare variables

dim wshnetwork

' suppress error messages

on error resume next

' set reference to WSH network object

set wshnetwork = wscript.createobject("wscript.network"

' remove network drive in case it is already in use

wshnetwork.removenetworkdrive "H:"
wshnetwork.removenetworkdrive "K:"
wshnetwork.removenetworkdrive "P:"
wshnetwork.removenetworkdrive "T:"
wshnetwork.removenetworkdrive "Y:"
wshnetwork.removenetworkdrive "Z:"

' add network drive

wshnetwork.mapnetworkdrive "H:","\server1userfiles"
wshnetwork.mapnetworkdrive "K:","\server2userfiles"
wshnetwork.mapnetworkdrive "T:","\server3user_files"
wshnetwork.mapnetworkdrive "Y:","\server4company"
wshnetwork.mapnetworkdrive "z:","\server5photos"

A bit simpler you'd agree: I call this from the login script by calling it as a vbs file.

I then go one step further (and cooler) and rename the drives by calling another vbs file; which includes:

'Rename Mapped Drives
On error resume next
Set oShell = CreateObject("Shell.Application"
Set network = CreateObject("WScript.Network"
mDrive = "T:"
oShell.NameSpace(mDrive).Self.Name = "Text Files from ERP Server"
mDrive = "H:"
oShell.NameSpace(mDrive).Self.Name = "Company1 Data"
mDrive = "K:"
oShell.NameSpace(mDrive).Self.Name = "Company2 Data"
mDrive = "Y:"
oShell.NameSpace(mDrive).Self.Name = "Company Shared Files"
mDrive = "z:"
oShell.NameSpace(mDrive).Self.Name = "Marketing Photos"
mDrive = "P:"
oShell.NameSpace(mDrive).Self.Name = network.UserName & "'s personal data"

Give that a try

Neil

neil_cardiff

17,113 posts

294 months

Thursday 23rd February 2006
quotequote all
neil_cardiff said:
I don't know about that particular script but this is what I do; it works a treat

' declare variables

dim wshnetwork

' suppress error messages

on error resume next

' set reference to WSH network object

set wshnetwork = wscript.createobject("wscript.network"

' remove network drive in case it is already in use

wshnetwork.removenetworkdrive "H:"
wshnetwork.removenetworkdrive "K:"
wshnetwork.removenetworkdrive "P:"
wshnetwork.removenetworkdrive "T:"
wshnetwork.removenetworkdrive "Y:"
wshnetwork.removenetworkdrive "Z:"

' add network drive

wshnetwork.mapnetworkdrive "H:","server1userfiles"
wshnetwork.mapnetworkdrive "K:","server2userfiles"
wshnetwork.mapnetworkdrive "T:","server3user_files"
wshnetwork.mapnetworkdrive "Y:","server4company"
wshnetwork.mapnetworkdrive "z:","server5photos"

A bit simpler you'd agree: I call this from the login script by calling it as a vbs file.

I then go one step further (and cooler) and rename the drives by calling another vbs file; which includes:

'Rename Mapped Drives
On error resume next
Set oShell = CreateObject("Shell.Application"
Set network = CreateObject("WScript.Network"
mDrive = "T:"
oShell.NameSpace(mDrive).Self.Name = "Text Files from ERP Server"
mDrive = "H:"
oShell.NameSpace(mDrive).Self.Name = "Company1 Data"
mDrive = "K:"
oShell.NameSpace(mDrive).Self.Name = "Company2 Data"
mDrive = "Y:"
oShell.NameSpace(mDrive).Self.Name = "Company Shared Files"
mDrive = "z:"
oShell.NameSpace(mDrive).Self.Name = "Marketing Photos"
mDrive = "P:"
oShell.NameSpace(mDrive).Self.Name = network.UserName & "'s personal data"

Give that a try

Neil



Bloody smilies

jamieboy

5,929 posts

259 months

Thursday 23rd February 2006
quotequote all
neil_cardiff said:
A bit simpler you'd agree
Looks exactly the same to me, no? You remove the drives first, and change the names afterwards, which are both good things to do, but the actual drive mapping code is the same as Claire's. Or is there a subtlety I'm missing?

Claire - maybe worth having a look at this:
http://support.microsoft.com/default.

If not, I'd blame your telecoms team. In fact, maybe do that regardless

Edit - not sure why the full link isn't showing, but the KB article is Q297684

>> Edited by jamieboy on Thursday 23 February 18:34

neil_cardiff

17,113 posts

294 months

Thursday 23rd February 2006
quotequote all
jamieboy said:
neil_cardiff said:
A bit simpler you'd agree
Looks exactly the same to me, no? You remove the drives first, and change the names afterwards, which are both good things to do, but the actual drive mapping code is the same as Claire's. Or is there a subtlety I'm missing?

Claire - maybe worth having a look at this:
http://support.microsoft.com/default.

If not, I'd blame your telecoms team. In fact, maybe do that regardless


Twas just posting a similar script to help her - didn't say whether it were better Having now looked through it I see that is almost the same.

So yes, I'd blame the Telecoms team.

Or at least put it down as a PEBCAK problem...

Gaffer

Original Poster:

7,156 posts

307 months

Thursday 23rd February 2006
quotequote all
Cheers guys.

Will give them a go...

Claire