Link to home
Create AccountLog in
Avatar of ellsworth2000
ellsworth2000

asked on

When using VBScript: nUser.MapNetworkDrive "I:", "\\Server\Share", how do you make the drive persistant?

Good Day Experts,

When using VBScript:  nUser.MapNetworkDrive "I:", "\\Fax\Scans", how do you make the drive persistant?  This is the whole script:

On Error Resume Next

'
' Set constants and variables
'

Dim wshShell
Dim Domain
Dim UserName
Dim nUser

Set wshShell = WScript.CreateObject("Wscript.Shell")
Set nUser = WScript.CreateObject("Wscript.Network")

Domain = nUser.UserDomain
UserName = nUser.UserName

'
' Map Company Folder
'

nUser.MapNetworkDrive "I:", "\\Server\Share"
nUser.MapNetworkDrive "J:", "\\Server\Share2"

'
'Clean Up
'
Set UserName=Nothing
Set nUser=Nothing
Set Domain=Nothing
_____________________________________End Script


Avatar of Chris Dent
Chris Dent
Flag of United Kingdom of Great Britain and Northern Ireland image


Hi,

You need to update the profile with the mapping. MapNetworkDrive accepts a third parameter for that:

objNetwork.MapNetworkDrive strDrive, strShare, True

The default for that is False (which is non-persistant).

Chris
Avatar of ellsworth2000
ellsworth2000

ASKER

Thank You for your Reply Chris-Dent,

what is the profile?  And where should the:  objNetwork.MapNetworkDrive strDrive, strShare, True be inserted to?

Many Thanks,

Ellsworth
ASKER CERTIFIED SOLUTION
Avatar of Chris Dent
Chris Dent
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Perfect!!!  Thanks Chris.

No problem :)

Chris