"Jon Paal [MSMD]" wrote:
http://forum.echoechoplus.com/showth...?threadid=7948
this may help
I've tried the WshNetwork route...still cant' get a successful connection
but I'm getting other error messages which suggest to me that at least it can
see the map.
I've been trying different drive letters usernames, passwords etc to try and
get a successful hookup.
However, when I run the code now it knocks out my IIS (or so it
appears)......I have to go and reboot the webserver. Wondering whats causing
that. Heres the script
Set WshShell = server.CreateObject("WScript.Shell")
Set WshNetwork = server.CreateObject("WScript.Network")
Set CheckDrive = WshNetwork.EnumNetworkDrives()
AlreadyConnected = False
DriveLetter = "P:" 'DriveLetter must be a CAPITAL letter
RemotePath = "\\server\sharedfolder"
username = "domainname\username"
pass = "password"
choice = "false"
if CheckDrive.count 0 then
For i = 0 To CheckDrive.Count - 1
If CheckDrive.Item(i) = DriveLetter Then AlreadyConnected = True
Next
If AlreadyConnected = True then
WshNetwork.RemoveNetworkDrive DriveLetter
WshNetwork.MapNetworkDrive DriveLetter, RemotePath, choice, username, pass
WshShell.PopUp "Drive " & DriveLetter & "Disconnected, then connected
successfully."
Else
WshNetwork.MapNetworkDrive DriveLetter, RemotePath, choice, username, pass
WshShell.PopUp "Drive " & DriveLetter & " connected successfully."
End if
else
WshNetwork.MapNetworkDrive DriveLetter, RemotePath, choice, username, pass
***this is where is hangs***
WshShell.PopUp "Drive " & DriveLetter & " connected successfully."
end if
Thank You for your assistance