Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

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

Posted on 2006-03-22
5
Medium Priority
?
462 Views
Last Modified: 2007-12-19
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


0
Comment
Question by:ellsworth2000
  • 3
  • 2
5 Comments
 
LVL 71

Expert Comment

by:Chris Dent
ID: 16263266

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
0
 

Author Comment

by:ellsworth2000
ID: 16263334
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
0
 
LVL 71

Accepted Solution

by:
Chris Dent earned 2000 total points
ID: 16263372

The profile is the user profile, it basically writes it to the user profile making the mapping persistant.

This is the translation to the syntax in your script:

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

Basically just add the third parameter onto each of the mappings you're doing. Sorry for the confusion.

Chris
0
 

Author Comment

by:ellsworth2000
ID: 16263501
Perfect!!!  Thanks Chris.
0
 
LVL 71

Expert Comment

by:Chris Dent
ID: 16267597

No problem :)

Chris
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article is in response to a question (http://www.experts-exchange.com/Networking/Network_Management/Network_Analysis/Q_28230497.html) here at Experts Exchange. The Original Poster (OP) requires a utility that will accept a list of IP addresses …
Resolve DNS query failed errors for Exchange
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

580 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