MapNetworkDrive Method
Adds a shared network drive to your computer system.
object.MapNetworkDrive(strLocalName, strRemoteName, [bUpdateProfile], [strUser], [strPassword])
The following code maps the logical drive "E" to a network share with the UNC name "\\Server\Public."
Dim WshNetwork
Set WshNetwork = WScript.CreateObject("WScript.Network")
WshNetwork.MapNetworkDrive "E:", "\\Server\Public"
var WshNetwork = WScript.CreateObject("WScript.Network"); WshNetwork.MapNetworkDrive ("E:", "\\\\Server\\Public");
Applies To:
PowerShell version
net use E: \\server\share /persistent:yes
Most of the time, you can use batch commands more easily than translating vbscript to PowerShell and it is just as effective.
Most of the time, you can use batch commands more easily than translating vbscript to PowerShell and it is just as effective.
- 11/4/2011
- Rich Prescott
- 11/4/2011
- Rich Prescott
PowerShell version:
$net = New-Object -com WScript.Network
$path = "\\Server\Public"
$drive = "E:"
$net.mapnetworkdrive($drive, $path, "true")
$path = "\\Server\Public"
$drive = "E:"
$net.mapnetworkdrive($drive, $path, "true")
- 11/3/2011
- Karl Mitschke