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. :unsure:
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.
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)
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")
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
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
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.