Does anyone know if you can and how to start off a scheduled Windows task on a Remote Server from within a SQL Server Integration Services (SSIS) package?
Assuming you run it on Windows Server 2003/2008 or Vista, use SSIS Execute Process Task to start SCHTASKS.EXE with appropriate params (SCHTASKS /Run /? to see details).
It should be possible as the Task Scheduler has a scriptable COM API that can be used for interacting with tasks.
You could therefore either create a custom task that uses COM interop to call the Task Scheduler API, or it'd probably be quicker to use an Active X Script task to do your dirty work.
I invested a lot of time in the aforementioned COM API back in 2002. It was, to put it mildly, "flakey".
What we ended up doing instead is having our tasks run every minute. The first thing the task did was check the database to see if it should continue running or not.
Then "starting" a scheduled task from SSIS was as simple as changing a database field.
Related
I have Pentaho-Spoon on my Windows machine and all the transformations/jobs are stored in a Database Repository.
Now, we want to set up a scheduler for the transformations and jobs.
Being a newbie, I just know that I need to use a batch file in Windows Scheduler with the address of kitchen.bat/pan.bat and address of the job/transformation to be scheduled.
Do I need to install the Pentaho Data Integration tool on the server as well on which the repository is located? And even if I do so how to get the address from the repository?
This can be done with the help of Windows Scheduler.Just need to trigger a batch file similar to the shown in the example below:
C:\\data-integration\kitchen.bat /rep:"PentahoRepository" /job:"TestJob" /dir:\<direcoryname> /user:<usernamm> /pass:<password> /level:Basic
Problem
I have developed an SSIS package for an ETL process, which I have deployed successfully to a remote server. I have windows and SQL logins for this server, but not admin. The data that this ETL process loads is generated on a different machine on a different domain early in the morning each day (i.e. before I get to work) and needs to be automatically loaded after the data generation process as soon as possible.
Currently, I manually run the ETL package in SSMS, and authenticate this by spoofing the windows user credentials on the remote server by launching SSMS with runas.exe. This is currently okay since we are in early development, but this is obviously not an acceptable solution in production. Hence, I would like to automate this process, since a) the data is extremely time sensitive and b) manually running this process is a PITA.
How should I go about automating execution of the ETL package such that:
Execution happens immediately after the data is available, and
No user input is required from me e.g. to enter passwords?
Attempted solutions
Scheduling a SQL server agent job on a schedule is not an option, because of the time sensitivity. (Also my sysadmin seems to have not enabled/disabled the SQL server agent)
Continuing to use runas.exe is not an option either, as the /netonly flag, which is required, and the /savecred flag, which would prevent the need for manual password entry, are mutually exclusive.
sqlcmd.exe can be scripted to run with a SQL user and password (bad practice putting passwords in plain text, I know) but then running a stored procedure that calls the SSIS package fails, as windows authentication is required to run the package.
I would strongly advice you to ask for working SQL Agent and create an Agent Job to run the package. This way has a lot of advantages:
Native Windows user credentials management with proxy accounts
You can configure specific values for package/project parameters, connection managers via SSMS interface
You can use environment references of SSIS 2012 and above, and manage it via SSMS as well
Job can be started on schedule or manually from SQL command. Thus you can automate package start.
In a nutshell - it is much easier to manage and you do not disclose user credentials needed to run the package - you might even do not know it.
For the alternative - you can try PsExec from SysInternals tools. It allows to start program on another computer explicitly specifying username and password as psexec \\server -u user -p password .... However, I would opt against it.
Situation
I have a Win 2012 server in which i run an exe which is essentially a GUI. The server restarts every monday so on monday morning i have to log-on to the server using a generic account and manually start the exe.
Setup
I am planning to automate the activity of starting the exe every monday. For that i have written a batch file which starts the exe with some parameters. Also i have created a scheduled task that runs on Monday and triggers the batch file. The trigger that i have used in the scheduled task is "At Startup".
ISSUE
The issue that i am facing is that after the server is restarted i am not seeing my GUI(exe) running. When i checked on the Task Manager it is showing it running as Background Process however it is not coming to front and i am not seeing the GUI. I might be wrong but i think the exe is running as a process/service instead of running as an App.
Can someone please suggest a solution for this issue.
Thanks in advance.
Running a Cmd.exe inside an ETL Process Task and it's failing with Exit code 1.
If I run the command as the same user I'm running the SQL Agent job as outside of the ETL it's running fine and giving Exit code 0.
I've seen some DCOM errors in Event Viewer and Ive taken steps to give permissions to the user I'm running the ETL through the SQL Agent Job for. However it's still failing.
Are there other things I should check about running a CMD command across servers as a specific user?
Just to say this was a permission issue ultimately for it to write a file inside the Default folder. It wasn't manifesting as such until I dumped out the Log a little more. I had to make the user I was running the agent job to be a part of the Administrators group on the SSIS server to allow the process to work.
I have a small program that I would like to turn into an installable windows.form. It needs to automatically be run as a cron job/scheduled task. How can I do this?
C#
You can either have it setup as a Windows Service or the at command can run it as a scheduled task.
http://support.microsoft.com/kb/313565