-
Expand SQL Server Agent, create a new job or right-click an existing job, and then click Properties. For more information about creating a job, seehttp://technet.microsoft.com/en-us/library/ms186273.aspx.
-
In the Job Properties dialog, click the Steps page, and then click New.
-
In the New Job Step dialog, type a job Step name.
-
In the Type list, choose Operating system (CmdExec).
-
In Run as list, select the proxy account with the credentials that the job will use. By default, CmdExec job steps run under the context of the SQL Server Agent service account.
-
In the Process exit code of a successful command box, enter a value from 0 to 999999.
-
In the Command box, enter powershell.exe with parameters specifying the PowerShell script to be run.
-
Click the Advanced page to set job step options, such as: 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 the file where SQL Server Agent can write the job step output. Only members of the sysadmin fixed server role can write job step output to an operating system file.