Windows Script Host  

Accessing Network Connections

The Network object enables you to access information about your network. The following scripts demonstrate how to map a network drive. In the first step, the script creates a Network Object. Next, the MapNetworkDrive method, one of the Network object's methods, performs the mapping operation. The MapNetworkDrive method takes five arguments:

// JScript.
var net;
net = new ActiveXObject("WScript.Network");
net.MapNetworkDrive("I:", "\\\\computer2\\public","True","jdoe","jdoepassword");

' VBScript.
Dim net
Set net = CreateObject("WScript.Network")    
net.MapNetworkDrive "I:", "\\computer2\public","True","jdoe","jdoepassword"

See Also

Accessing Networks