[dba-Tech] reconnect/logon to network drive

Steve Erbach erbachs at gmail.com
Tue May 20 16:45:52 CDT 2008


Peter,

You're welcome.

Steve Erbach

On Tue, May 20, 2008 at 4:10 PM, Peter Brawley
<peter.brawley at earthlink.net> wrote:
> Steve,
>
> Thanks! The links helped me write...
>
> Option explicit
> Dim objNetwork,objFSO,strDrive,strPath
> strDrive = "K:"
> strPath = "\\SERVERNAME\backup"
> Set objFSO = CreateObject( "Scripting.FileSystemObject" )
> Set objNetwork = CreateObject( "WScript.Network" )
> if objFSO.DriveExists("K:") Then
>  objNetwork.RemoveNetworkDrive strDrive
> End If
> objNetwork.MapNetworkDrive strDrive, strPath
> WScript.Echo "Mapped " & strDrive & " to " & strPath
> objNetwork.RemoveNetworkDrive strDrive
> WScript.Echo "Unmpped " & strDrive
>
> ... which, for someone who breaks out in a rash on contact with VB, is
> terrific!
>
> PB



More information about the dba-Tech mailing list