VBS — example Map drive

Home Forums Scripting Windows Script Host VBS — example Map drive

This topic contains 2 replies, has 2 voices, and was last updated by Avatar origin05 15 years, 1 month ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • Avatar
    Dumber
    Participant
    #98117

    A simple example te map driveletters to shared resources:

    Code:
    ‘ AUTHOR: Marcel Henderik
    ‘Comment: simple example to create mapped drives.

    Dim Network
    Set Network = CreateObject(”Wscript.network”)

    Network.MapNetworkDrive “G:”, “\Server1Data”
    Network.MapNetworkDrive “J:”,”\Server2groups”
    Network.MapNetworkDrive “K:”, “\Server1alg”

    Avatar
    origin05
    Member
    #217016

    tried this one but then realize that the drives will disappears after sometime and needs to run the script again to get the drive back.

    is there a way .. via the script to make the connection persistent?

    Also I would like to know how i can do a prefix drive letter to a particular shared drive for example : f: \server1share where f: cannot be replaced by any other drive letters.?

    Avatar
    Dumber
    Participant
    #194379
    origin05 wrote:
    is there a way .. via the script to make the connection persistent?

    place ,true at the end, for example:

    Code:
    ‘ AUTHOR: Marcel Henderik
    ‘Comment: simple example to create mapped drives.

    Dim Network
    Set Network = CreateObject(”Wscript.network”)

    Network.MapNetworkDrive “G:”, “\Server1Data” ,true
    Network.MapNetworkDrive “J:”,”\Server2groups” ,true
    Network.MapNetworkDrive “K:”, “\Server1alg” ,true

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.