Password in Batch File

  • We are using Win2k/sql2k. I have a user who runs a .bat file that executes dtsrun. The user name and password for the sqlserver login is included in the command. Is there a way to execute the DTS package or a job without having to include the password in the command line? The job that executes the .bat file is scheduled by WINAT so I think we have to use a sqlserver login. Any help on this or a workaround would be greatly appreciated.

    Edited by - ed yasutake on 02/20/2003 11:39:45 AM

  • You should run the OSQL command with trusted mode. (-E option). Or put what ever you want to execute on schedule into a job within SQL server.

  • How can I run it in trusted mode when it's launched by an AT job or how can a job scheduled from WINAT log on as a trusted connection?

  • The user id that the Task Scheduler ( WINAT )uses would need to be granted access to the SQL Server. Usually, the Task Sceduler uses a Local System account so it would need to be changed to a domain account.

    Thanks

    Phill Carter

    --------------------

    Colt 45 - the original point and click interface

    --------------------
    Colt 45 - the original point and click interface

  • If the task scheduler and SQL Server box are one and the same, I think you can add local accounts to SQL Server and still use the trusted option.

    Gregory Larsen, DBA

    If you looking for SQL Server Examples check out my website at http://www.geocities.com/sqlserverexamples

    Gregory A. Larsen, MVP

  • Greg Larsen has the right idea. Use an account in your scheduler and add it as a trusted account

    Steve Jones

    sjones@sqlservercentral.com

    http://www.sqlservercentral.com/columnists/sjones

    http://www.dkranch.net

  • Hello,

    Trusted account is the best solution but if you can't use it you should consider encrypting your dtsrun command line.

    The encrypted command line can be generated by dtsrun with /!Y flag added to your current args or in advanced tab of dtsrunui.

    Meher Necib.

Viewing 7 posts - 1 through 7 (of 7 total)

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