Results 1 to 7 of 7

Thread: Auto Mapping Network Drive VBS

  1. #1
    Join Date
    Apr 2010

    Auto Mapping Network Drive VBS

    Indeed people connected via VPN SAR Win2003 does not have mapped drives, you must tell me that users open their sessions by ticking the box "open the session using a remote connection", the problem is that users do not have all the time the VPN active (work locally) and in hotels such as the WiFi is no authentication for network connection but then there is an HTTP authentication to have access to the net. You'll understand this option works only 100% with an RJ45 Ethernet connection. I tried to look for scripts for Win 2003 VPN server to map network drives but without success. So please provide me the VBS for Auto Mapping Network Drive.

  2. #2
    Join Date
    May 2008

    Re: Auto Mapping Network Drive VBS

    If you know the basic script of it, here are some hints :
    Set Net = CreateObject ("WScript.Network) 
    Username = Net.UserName 
    Set objNetwork = CreateObject ("WScript.Network) 
    objNetwork.MapNetworkDrive "U", "\ \ <server> \" + Username
    Hope that it helps you.

  3. #3
    Join Date
    Feb 2008

    Re: Auto Mapping Network Drive VBS

    I would like to tell you that there is absolutely no need to create a second object in memory. The following will help you in understanding this :
    With WshNetwork 'uses the object classes :
    Set = oDrives. EnumNetworkDrives 
    Set = oPrinters. EnumPrinterConnections 
    Username =. UserName 
    . MapNetworkDrive "U", "\ \ <server> \" + Username 
    End With
    'Do not forget to free the object instance in memory
    = Nothing Set WshNetwork. Save rather like :
    Set WshNetwork = CreateObject ("WScript.Network)

  4. #4
    Join Date
    Jan 2006

    Re: Auto Mapping Network Drive VBS

    The following code uses the methods and RemoveNetworkDrive MapNetworkDrive WshNetwork class of Windows Script Host. The main parameters of the unit MapNetworkDrive to mapera :
    MapNetworkDrive (Local, User, Password)
    Where username and password are optional parameters.
    For example to map a drive, the following code would be useful :
    obj_Wsh.MapNetworkDrive ("Z", "\ \ hostname \ Name_DelRecurso_Comparator)
    To remove the old drive mapped :
    obj_Wsh.RemoveNetworkDrive ("Z")

  5. #5
    Join Date
    May 2008

    Re: Auto Mapping Network Drive VBS

    Using VBScript for logon scripts is much more powerful than execute. Bat with DOS commands. To assign these scripts to users can do in various ways, depending on the operating system. In AD users and computers can edit the properties of each user, and in your profile you can specify a log file, which have previously been placed in the application of a DC NETLOGON. This file is run whenever you log on. However, we note that the pre-Windows 2000 computers can not directly execute files with. Vbs, so if this type of equipment we have what we have to do is put as a logon script file. bat, which also will place in the NETLOGON, and they include a line like this to launch. vbs

    WScript% 0 \ .. \ miscript.vbs

  6. #6
    Join Date
    Mar 2008

    Re: Auto Mapping Network Drive VBS

    I am trying to explain you how to create a network drive from a computer network and share, using VBS (Visual Basic Script. To run this code is enough to copy it to a plain text file (plain) and put in extension "vbs . Double-clicking the file will be compiled automatically. This applies to operating systems Windows XP, Windows Vista, Windows 2000 Server, Windows Server 2003, Windows Server 2008.
    Object objDisco = CreateObject ("Scripting.FileSystemObject")
     Object objRed = WScript.CreateObject ("WScript.Network)
     driveletter = InputBox ("Enter the drive letter (with two points at the end):")
     rutaBNC = InputBox ("Enter the path BNC type \ \ computer \ share")
     username = InputBox ("Username:")
     password = InputBox ("Password:")
     On Error Resume Next
     objRed.MapNetworkDrive driveletter, rutaBNC, true, username, password
     If objDisco.FolderExists (drive letter) Then 
        wscript.echo "created network drive properly."
        Wscript.Echo "Error creating network drive."
     End If

  7. #7
    Join Date
    Oct 2008

    Re: Auto Mapping Network Drive VBS

    The following are the code in VBS :
    Sun onet 
    Set onet = CreateObject ("WScript.Network) 
    oNet.MapNetworkDrive "Z", "\ \ foo \ shared directory" 
    The above script will connect a network drive to drive Z.

Similar Threads

  1. An extended error has occured when mapping a network drive
    By ndaka123488 in forum Hardware Peripherals
    Replies: 3
    Last Post: 03-01-2014, 04:12 PM
  2. Mapping a Network drive.
    By medic1202 in forum Windows Server Help
    Replies: 2
    Last Post: 03-02-2012, 08:27 PM
  3. Network mapping tool (auto discovery)
    By Xylina in forum Technology & Internet
    Replies: 9
    Last Post: 24-02-2011, 08:27 AM
  4. Problem While Mapping Network Drive
    By Aberto in forum Networking & Security
    Replies: 4
    Last Post: 24-01-2009, 10:29 AM
  5. Windows XP Network Drive Mapping
    By JoJo19 in forum Networking & Security
    Replies: 2
    Last Post: 16-07-2008, 02:18 PM

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Page generated in 1,642,521,218.06556 seconds with 17 queries