Announcement

Collapse
No announcement yet.

VBS -- example Map drive

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • VBS -- example Map drive

    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:", "\\Server1\Data"
    Network.MapNetworkDrive "J:","\\Server2\groups"
    Network.MapNetworkDrive "K:", "\\Server1\alg"
    Marcel
    Technical Consultant
    Netherlands
    http://www.phetios.com
    http://blog.nessus.nl

    MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
    "No matter how secure, there is always the human factor."

    "Enjoy life today, tomorrow may never come."
    "If you're going through hell, keep going. ~Winston Churchill"


  • #2
    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: \\server1\share where f: cannot be replaced by any other drive letters.?

    Comment


    • #3
      Originally posted by origin05
      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:", "\\Server1\Data" ,true
      Network.MapNetworkDrive "J:","\\Server2\groups" ,true
      Network.MapNetworkDrive "K:", "\\Server1\alg" ,true
      Marcel
      Technical Consultant
      Netherlands
      http://www.phetios.com
      http://blog.nessus.nl

      MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
      "No matter how secure, there is always the human factor."

      "Enjoy life today, tomorrow may never come."
      "If you're going through hell, keep going. ~Winston Churchill"

      Comment

      Working...
      X