invoke .bat or .vbs from SQL-Jobs

  • Hi there

    i am using the following way to inoke a .bat file which internally invokes .vbs file but it dosent seem to work

    Type :- CmdExec

    Run as :- SQL Agent Service Account

    Command :- D:\xyz\Scripts\DB_Trans_Log_Ship.vbs

    But if i invoke "DB_Trans_Log_Ship.vbs" or .bat file manually by double clicking the funcationality works

    but when i force run the SQL-Job or schedule it it dosent work

    pls advice

    Cheers

  • sqlcool (9/25/2009)


    Hi there

    i am using the following way to inoke a .bat file which internally invokes .vbs file but it dosent seem to work

    Type :- CmdExec

    Run as :- SQL Agent Service Account

    Command :- D:\xyz\Scripts\DB_Trans_Log_Ship.vbs

    But if i invoke "DB_Trans_Log_Ship.vbs" or .bat file manually by double clicking the funcationality works

    but when i force run the SQL-Job or schedule it it dosent work

    pls advice

    Cheers

    The chances ar that you might have a permissions issue using the sql agent account, you could also try using cscript.exe for running the .vbs file as well.

    --------------------------------------------------------------------------------------
    [highlight]Recommended Articles on How to help us help you and[/highlight]
    [highlight]solve commonly asked questions[/highlight]

    Forum Etiquette: How to post data/code on a forum to get the best help by Jeff Moden[/url]
    Managing Transaction Logs by Gail Shaw[/url]
    How to post Performance problems by Gail Shaw[/url]
    Help, my database is corrupt. Now what? by Gail Shaw[/url]

  • what kinda permission the user account who is invoking the job has all the permissions i have also checked the sysadmin permission for that user.

    is there any examples are link you can provide with i tried my best

  • change your job to say

    cscript.exe D:\xyz\Scripts\DB_Trans_Log_Ship.vbs

    and let me know if that works

    if you type cscript in a dos prompt, you can see the parameters for it.

    --------------------------------------------------------------------------------------
    [highlight]Recommended Articles on How to help us help you and[/highlight]
    [highlight]solve commonly asked questions[/highlight]

    Forum Etiquette: How to post data/code on a forum to get the best help by Jeff Moden[/url]
    Managing Transaction Logs by Gail Shaw[/url]
    How to post Performance problems by Gail Shaw[/url]
    Help, my database is corrupt. Now what? by Gail Shaw[/url]

  • hi i got this error

    The step did not generate any output. Process Exit Code 1. The step failed.

  • if i go to cmd prompt and type cscript.exe d:..../aa.vbs it works

    but not from SQL-job agent

  • do a run as when you open your dos session, and use the same account as what the sql agent account is, and try that

    --------------------------------------------------------------------------------------
    [highlight]Recommended Articles on How to help us help you and[/highlight]
    [highlight]solve commonly asked questions[/highlight]

    Forum Etiquette: How to post data/code on a forum to get the best help by Jeff Moden[/url]
    Managing Transaction Logs by Gail Shaw[/url]
    How to post Performance problems by Gail Shaw[/url]
    Help, my database is corrupt. Now what? by Gail Shaw[/url]

  • it works through CMD prompt as per ur instructions but not in SQL-agent

    runas /user:microsoft\xyz "d:\microsoft\scripts\db_trans_log_ship.bat"

    Enter the password for microsoft\xyz :- asddassadad

    opens a small popup black window for 1 sec and

    Attempting to start d:\microsoft\scripts\db_trans_log_ship.bat as user "microsoft\xyz" ....

  • my .bat file code

    @ECHO OFF

    start D:\microsoft\Scripts\DB_Trans_Log_Ship.vbs

Viewing 9 posts - 1 through 8 (of 8 total)

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