|
| ||||||||||
| Tags: auto mapping, http authentication, network drive, vbs, vpn server, wifi, win2003, windows 2000, windows server 2008, windows vista, windows xp, wshnetwork |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| Auto Mapping Network Drive VBS
![]() |
|
#2
| ||||
| ||||
| 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 |
|
#3
| ||||
| ||||
| 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 = Nothing Set WshNetwork. Save rather like : Code: Set WshNetwork = CreateObject ("WScript.Network) |
|
#4
| ||||
| ||||
| 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) For example to map a drive, the following code would be useful : Code: obj_Wsh.MapNetworkDrive ("Z", "\ \ hostname \ Name_DelRecurso_Comparator) Code: obj_Wsh.RemoveNetworkDrive ("Z") |
|
#5
| ||||
| ||||
| 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 |
|
#6
| ||||
| ||||
| 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 |
|
#7
| |||
| |||
| 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 |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "Auto Mapping Network Drive VBS" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Mapping a Network drive. | medic1202 | Windows Server Help | 2 | 03-02-2012 07:27 PM |
| An extended error has occured when mapping a network drive | ndaka123488 | Hardware Peripherals | 1 | 29-09-2011 11:47 AM |
| Network mapping tool (auto discovery) | Xylina | Technology & Internet | 9 | 24-02-2011 07:27 AM |
| Problem While Mapping Network Drive | Aberto | Networking & Security | 4 | 24-01-2009 09:29 AM |
| Windows XP Network Drive Mapping | JoJo19 | Networking & Security | 2 | 16-07-2008 02:18 PM |