scheduling powershell tasks with sql agent
Hi
How to run a powershell script through SQL Server agent.
SQL Server | Other
2 answers
Sort by: Most helpful
-
-
PandaPan-MSFT 1,931 Reputation points2022-08-25T01:54:28.857+00:00 Hi,@SVA
I’m agree with what @Tom Phillips has already put before. His answer was perfect seems to me.
You just need to follow the steps below:
1.Expand SQL Server Agent, create a new job or right-click an existing job, and then select Properties.
2.In the Job Properties dialog, select the Steps page, and then select New.
3.In the New Job Step dialog, type a job Step name.
4.In the Type list, select PowerShell.
5.In the Run as list, select the proxy account with the credentials that the job will use.
6.In the Command box, enter the PowerShell script syntax that will be executed for the job step. Alternately, select Open and select a file containing the script syntax.
7.Select the Advanced page to set the following job step options: what action to take if the job step succeeds or fails, how many times SQL Server Agent should try to execute the job step,
and how often retry attempts should be madeBest regards