>I have a job that runs at night on a machine that has no users logged on. I am trying to programatically log on to the network.
>
>I am using NT 4.0
>
>Does anyone know if you can do this in a batch file or any other way?
You can do this using the Wscript.Network Automation Object by attaching resources on a server; the Wscript.Network object's MapNetworkDrive method will accept a userid and password as the 4th and 5th arguments, which will be used when making the connection to the server. You'll need to install the Windows Scripting Host to use this; the Automation objects are usable from scripts, VB, VBA, VFP, etc.
If I've installed the WSH, the following VFP code works:
oNet = CREATEOBJ('Wscript.network')
oNet.MapNetworkDrive('H:', '\\MyServer\MyShare', .F., cUserName, cPassword)
In VBScript:
Set WshNet = Wscript.CreateObject("Wscript.Network")
WshNet.MapNetworkDrive "H:", "\\MyServer\MyShare", FALSE, "Username", "Password"