' MapNetworkDrive.vbs
' VBScript to map a network drive.
' Author Guy Thomas http://computerperformance.co.uk/
' Version 2.2 - April 24th 2005
' -----------------------------------------------------------------'
Option Explicit
Dim objNetwork
Dim strDriveLetter, strRemotePath, strFileName
Dim objFileSystem, objOutputFile
Dim strOutputFile
Dim MyArray(2)

strDriveLetter = "Z:"
strRemotePath = "\\Old_duder\TEMP_DOCS"
strFilename="\test.txt"

MyArray(0)=strDriveLetter
MyArray(1)=strFilename

strOutputFile=Join(MyArray,"")

MsgBox(strOutputFile)

' Purpose of script to create a network object. (objNetwork)
' Then to apply the MapNetworkDrive method.  Result J: drive
Set objNetwork = WScript.CreateObject("WScript.Network")

objNetwork.MapNetworkDrive strDriveLetter, strRemotePath

set objFileSystem= CreateObject("Scripting.fileSystemObject")
set objOutputFile= objFileSystem.CreateTextFile(strOutputFile, True)

objOutputFile.Writeline("Hello world (" & Now &")")
objOutputFile.Close

Set objFileSystem=Nothing

WScript.Quit(0)

'WScript.Quit

' End of script.