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?
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