VBScript error when trying to run vbscript from SQL Agent Job

Hi All,

SQL 2012 here.

I have a cmd line, using cscript to call a .bat file on a remote server. The .bat file then calls a vbs which merges several Excel files into one single Excel file in the same location.

When I call the .bat file from my desktop, everything runs fine, file gets created on the remote share.

When I put the cmd line into a SQL Agent Job, on a local SQL Server, I get the following error (though the job runs successfully)

Microsoft VBScript runtime error: ActiveX component can't create object: 'Excel.Application

The local SQL Server, has its SQL Server and SQL Server Agent running under my domain account so I would assume it has the same permission/access as when I run it directly in a command prompt.

I am a local admin to my desktop.

I've tried adding my account explicit in DCOMCNFG --> COM SECURITY --> Edit Default --> both Access Permissions and Launch and Activation Permissions with no luck - same error.

Any ideas? Thanks in advance.

September 9th, 2015 9:58am

A potential problem is that Excel likes to interact with the desktop, but you cannot do that from a service like SQL Server Agent.

Free Windows Admin Tool Kit Click here and download it now
September 9th, 2015 5:58pm

You can schedule this in windows task manager. If you still have runtime error then some thing wrong in the code.

If you are able to run from command prompt i am sure you are able to schedule in task manager.

When you execute from SQL agent environment is finding difficulty to import Active-X components.

September 9th, 2015 7:32pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics