April 30, 2005 at 6:19 am
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?
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
April 30, 2005 at 10:58 am
It sounds like account issue, what type service account do you use to run SQL Server Agent and what permissions does it have to the share drive in AS400?
May 2, 2005 at 6:33 am
SQL Server Agent is running as a domain user with elevated rights on the box (local admin). It does not have any rights to the share on the AS400 because the AS400 will not authenticate a windows user. When I attempt to map the drive, I pass in the as400 userid and password to make the connection.
I am confused as to why the same script works from inside the DTS designer or as a .vbs file.
May 2, 2005 at 11:37 am
When you run that script from a Job it is using SQL Server Agent service credentials. Services do not know anything about mapped drives because that information is kept in the user profile which services don't have. When you run it from DTS and vbs is using your user credentials and your user account does have a user profile associated
Use direct access with unc path instead!
hth
* Noel
May 2, 2005 at 11:40 am
Noeld, Thanks, your post makes sense to me, I will give it a try.
May 2, 2005 at 11:42 am
Noeld, when you use direct access, is there a way to use a specified userid and password. That was why I was trying to map the drive. The as400 will require as400 security authentication, not windows.
Thanks
May 2, 2005 at 11:43 am
No Problem, Feel free to post again if you find any more problems
* Noel
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply