Go Back   TechArena Community > Technology > Networking & Security
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Auto Mapping Network Drive VBS

Networking & Security


Reply
 
Thread Tools Search this Thread
  #1  
Old 09-05-2010
Member
 
Join Date: Apr 2010
Posts: 80
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.

Reply With Quote
  #2  
Old 09-05-2010
Member
 
Join Date: May 2008
Posts: 2,944
Re: Auto Mapping Network Drive VBS

If you know the basic script of it, here are some hints :
Code:
Set Net = CreateObject ("WScript.Network) 
Username = Net.UserName 

Set objNetwork = CreateObject ("WScript.Network) 
objNetwork.MapNetworkDrive "U", "\ \ <server> \" + Username
Hope that it helps you.
Reply With Quote
  #3  
Old 09-05-2010
Member
 
Join Date: Feb 2008
Posts: 2,630
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 :
Code:
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 :
Code:
Set WshNetwork = CreateObject ("WScript.Network)
Reply With Quote
  #4  
Old 09-05-2010
Member
 
Join Date: Jan 2006
Posts: 4,215
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 :
Code:
MapNetworkDrive (Local, User, Password)
Where username and password are optional parameters.
For example to map a drive, the following code would be useful :
Code:
obj_Wsh.MapNetworkDrive ("Z", "\ \ hostname \ Name_DelRecurso_Comparator)
To remove the old drive mapped :
Code:
obj_Wsh.RemoveNetworkDrive ("Z")
Reply With Quote
  #5  
Old 09-05-2010
Member
 
Join Date: May 2008
Posts: 3,514
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

Code:
WScript% 0 \ .. \ miscript.vbs
Reply With Quote
  #6  
Old 11-05-2010
Member
 
Join Date: Mar 2008
Posts: 151
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.
Code:
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."
 Else
    Wscript.Echo "Error creating network drive."
 End If
Reply With Quote
  #7  
Old 12-05-2010
Member
 
Join Date: Oct 2008
Posts: 137
Re: Auto Mapping Network Drive VBS

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

  TechArena Community > Technology > Networking & Security
Tags: , , , , , , , , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


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


All times are GMT +5.5. The time now is 03:26 PM.