Home NT WSH
WshNetwork.MapNetworkDrive

Add a shared network drive mapping.

Syntax 
      WshNetwork.MapNetworkDrive(strLocalName, strRemoteName,
                  [bUpdateProfile], [strUser], [strPassword])

options:

   strLocalName   : The drive letter (e.g. L:)
   
   strRemoteName  : The UNC path to the remote drive \\MyServer\MyPrinter
                    (String value)
   
   bUpdateProfile : Store the mapping persistently in the
                    users profile. (Boolean, default = false)
   
   strUser        :  The user name. (Optional)
   
   strPassword    :  The password. (Optional)

Example

   Dim WshNetwork
   Set WshNetwork = CreateObject("WScript.Network")
   WshNetwork.MapNetworkDrive "I:", "\\print_server\hp_01","True","jdoe","jdoepassword"

"The price one pays for pursuing any profession or calling is an intimate knowledge of its ugly side" - James Baldwin

Related commands:

NET, list drive mappings - WshNetwork.EnumNetworkDrives
NET, remove drive map - WshNetwork.RemoveNetworkDrive

Equivalent Windows NT command:

NET - Manage network resources



Back to the Top

Simon Sheppard
SS64.com