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.
Arguments for MapNetworkDrive Method
-
The local drive assignment (I:, for example)
-
The Universal Naming Convention (UNC) path to the mapped remote drive
-
An optional Boolean indicating whether the drive will be persistently connected
-
An optional user name if you want to use different credentials
-
An optional password for use with the alternate user name
Copy Code // JScript. var net; net = new ActiveXObject("WScript.Network"); net.MapNetworkDrive("I:", "\\\\computer2\\public","True"); ' VBScript. Dim net Set net = CreateObject("WScript.Network") net.MapNetworkDrive "I:", "\\computer2\public","True"