You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are several types of SQL Server Agent job steps. Each type is associated with a subsystem that implements a specific environment, such as a replication agent or command prompt environment. You can code Windows PowerShell scripts, and then use SQL Server Agent to include the scripts in jobs that run at scheduled times or in response to SQL Server events. Windows PowerShell scripts can be run using either a command prompt job step or a PowerShell job step.
27
27
@@ -35,7 +35,7 @@ Each SQL Server Agent job step that runs PowerShell with the **sqlps** module la
35
35
36
36
## <aname="PShellJob"></a> Create a PowerShell Job Step
37
37
38
-
### To create a PowerShell job step
38
+
### Create a PowerShell job step
39
39
40
40
1. Expand **SQL Server Agent**, create a new job or right-click an existing job, and then select **Properties**. For more information about creating a job, see [Creating Jobs](../ssms/agent/create-jobs.md).
41
41
@@ -53,7 +53,7 @@ Each SQL Server Agent job step that runs PowerShell with the **sqlps** module la
53
53
54
54
## <aname="CmdExecJob"></a> Create a Command Prompt Job Step
55
55
56
-
### To create a CmdExec job step
56
+
### Create a CmdExec job step
57
57
58
58
1. Expand **SQL Server Agent**, create a new job or right-click an existing job, and then select **Properties**. For more information about creating a job, see [Creating Jobs](../ssms/agent/create-jobs.md).
59
59
@@ -67,7 +67,7 @@ Each SQL Server Agent job step that runs PowerShell with the **sqlps** module la
67
67
68
68
6. In the **Process exit code of a successful command** box, enter a value from 0 to 999999.
69
69
70
-
7. In the **Command** box, enter commands beginning with PowerShell.exe with parameters specifying the PowerShell script to be run. These examples are similar to the syntax for executing PowerShell commands from a Windows command prompt. Refer to `PowerShell.exe -?` for all the possible syntax options.
70
+
7. In the **Command** box, enter PowerShell.exe with parameters specifying the PowerShell script to be run. This is pretty much what you would write at a cmd command prompt, so take a look at `PowerShell.exe -?` for all the possible options.
71
71
72
72
- Example 1: Runs a simple cmdlet.
73
73
```cmd
@@ -82,7 +82,7 @@ Each SQL Server Agent job step that runs PowerShell with the **sqlps** module la
8. select 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.
85
+
8. Select 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.
0 commit comments