In this recipe, we will create a simple SQL Server job programmatically.
We are going to create a simple job called
Test Job and set up
tstark as our operator. We added
tstark as an operator in the recipe Adding a SQL Server operator. If you don't have
tstark, choose another SQL Server operator that's available in your instance.
Let's look at the steps required to create a SQL Server
#import SQL Server module Import-Module SQLPS -DisableNameChecking #replace this with your instance name $instanceName = "localhost" $server = New-Object -TypeName Microsoft.SqlServer.Management.Smo.Server ...