Permissions in a VB Script that is started as a SQL Server Job

  • I have Sql Server2008 on Windows Server Enterprise

    I created a job that executes a command line vbScript.

    The script reads an Excel spreadsheet and creates a file that some other job reads into sql server

    I know it sounds weird, but that's the architecture here and I'm not about to reorganize all this.

    I can execute the vb script from the command line just fine.

    However, when started from the job, I get a permission error on the

    createobject statement. I've read through lots of forums and have tried

    setting the dcom permissions for 'Network service', Everyone..

    but without any luck. I've tried changing the launch user to interactive, to admin, I've set it to no authentication.

    I've clicked on the properties of Excel application and changed the properties there.

    The job is started with Type=Operating System (SmcExec), Run as: SQL Server Agent Service Account cmd=CScript C:\myDir\js.vbs

    In the history, I see

    "The job was invoked by user sa"

    "Executed as user WORKGROUP\myhostname$

    and the permission error, js.vbs line 28 Permission Error CreateObject

    Any ideas are gratefully appreciated and welcomed.

    thanks.

    jonathan

  • Make sure that "WORKGROUP\myhostname$" has access to everything it needs. (I'm not sure if a myhostname$ account can access network resources.) Otherwise you might want to create a SQL Agent proxy account and configure the job to run as a different user.

  • good suggestion, I'll check ity out - thanks

  • Can you help me on what I need to do to check permissions.

    I'm not actually sure of the definition of network resources.

    All files are local, and I'm pretty sure Excel was installed by

    user administrator for all users.

    It seems like the script was started as workgroup\hostname$

    I do not see hostname$ as a user on my machine. I see Administrator,

    sa, and some others but not hostname$. Is this really a uesr?

    The user seems like it can do everything except

    CreateObject Excel.Application

    thanks again,

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply