June 28, 2014 at 6:55 am
Hi
I have created a SQL Agent Job with a powershell step. The powershell script looks like the following:
Param
(
[string]$A,
[string]$B,
[int]$C
)
#Do something with $A,$B and $C
Now I have added it as a step and then created the job. What I am not able to figure out is how can I execute this job by passing parameters to the powershell script?
June 28, 2014 at 8:51 am
I use the Operating system (CmdExec) type to run Powershell scripts from jobs instead of the Powershell type. For parameters in that type just add them after the script name. Here's a command example from something that works for me.
C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -NoProfile -WindowStyle Hidden -Command E:\temp\someScript.ps1 param1 param2 33
July 3, 2014 at 5:32 am
This is the solution I am also following currently. Thanks a lot
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy