Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scheduled Activex job keeps failing - mapping network drive

Status
Not open for further replies.

k8277

Programmer
Jan 10, 2003
104
US
I have a sql agent job setup that runs a simple activex (vbscript) script to map a drive to our AS400. When I run the scheduled job, the job is successful, however it maps the drive as Z:\Disconnected Network Drive. I can access the share, but I can't disconnect the mapped drive in a later step.

The frustrating part is that if I create a DTS package with the same script and run it from inside DTS designer it works just fine. Also, if I create a .vbs file and run it from Windows Explorer it will work ok.

What is causing the problem when it is run as a job step?

Code:
Option Explicit

Function Main()

Dim WshNetwork, oDrives

Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.MapNetworkDrive "z:","\\as400\share\",false,"user","password"

Set WshNetwork = nothing

Main = true
End Function
 
When the job runs it will run on the server where the DTS package was created. Consequently the mapped drive "z:" probably doesn't exist. Try using a DSN path and filename like \\ServerName\as400\share.
 
mkal,

I am not sure what you mean in your post. I do not want to use the DTS package, I just mentioned that it does work as a DTS. Also, as far as the DSN path, that is what \\as400\share is. as400 is the servername. Are you suggesting setting up a DSN instead of trying to map the drive?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top