# Net_MapNetworkDrive

> Maps a network drive. Can disconnect if an existing drive is mapped.

Source: https://docs.capaone.com/capainstaller/vb-scripting-library/network-functions/net-mapnetworkdrive/  
Product: CapaInstaller — a separate CapaSystems product; do not apply this page to any other.

### Description

Maps a network drive. Can disconnect if an existing drive is mapped. Use Domain\UserName if you wish to map a drive using another User.   
Using \* as password, the CapaInstaller reads and decrypts the password if it has been encrypted using CapaInstaller.   
See more about the password encryption feature [Using passwords in CapaInstaller VB Scripting Library](/capainstaller/vb-scripting-library/using-passwords-in-capainstaller-vb-scripting-library/)

### Syntax

Net_MapNetworkDrive(sDrive, sServerShare, bDisconnectExisting, sUserName, sPassword) As Boolean

### Parameters

#### sDrive (String)

Drive letter to map

#### sServerShare (String)

UNC path to map

#### bDisconnectExisting (Boolean)

Disconnect existing device if already mapped

#### sUserName (String)

Username. Use if you must connect with another user

#### sPassword (String)

Password for the user. Use \* if the password is encrypted by CapaInstaller in registry

### Example

**VBScript**

```vb
If bStatus Then bStatus = Net_MapNetworkDrive("Q:", "\\CAPAINSTALLER\PRINTERSHARE", True, "", "") 
```

[Scripting Guidelines](/capainstaller/vb-scripting-library/scripting-guidelines/)

### Related functions

[Net_RemoveNetworkDrive](/capainstaller/vb-scripting-library/network-functions/net-removenetworkdrive/) [Net_EnumNetworkDrives](/capainstaller/vb-scripting-library/network-functions/net-enumnetworkdrives/) [Net_EnumNetworkDrivePaths](/capainstaller/vb-scripting-library/network-functions/net-enumnetworkdrivepaths/) [Constants](/capainstaller/vb-scripting-library/addendum/constants/) [Package Property](/capainstaller/vb-scripting-library/addendum/package-property/) [Variables](/capainstaller/vb-scripting-library/addendum/variables/)
