MapNTDrive()

code

' -----------------------------------------------
' MapNTDrive()
' Connects a network device against a share in an
' NT domain.
' -----------------------------------------------

Sub MapNTDrive(strDrive, strUNC, strNT4UserName, strNT4Passwd)
on error resume next
WScript.StdOut.Write "Connects device " & strDrive & " ..."

objWshNet.MapNetworkDrive strDrive, strUNC, False, strNT4UserName, strNT4Passwd

If Err.Number <> 0 Then
WScript.StdOut.WriteLine "Failed!"
'DisplayText "Error: " & Err.Description 'Do we need the error number???
WScript.StdOut.WriteLine "Error: " & Err.Description & "Err#: " & Err.Number
Else
WScript.StdOut.WriteLine "done!"
End If
End Sub

example

MapNTDrive("I:", "\\carnsto10\winapps", "administrator", "qwerty")

description

Maps a device name against a network share, providing user name and password for identification.
Designed as a way to map against a share in an untrusted NT domain.
Requires:  Drive letter, UNC path to share, user name and password (all as strings).
Returns:  Nothing.