Creating SQL Agent Jobs to Run PowerShell

In one of my articles, Calling Procs from PowerShell with Parameters, there was a question in the discussion about calling PowerShell (PoSh) from SQL Agent Jobs. I haven’t done much of that, as most of my PowerShell is interactive scripts to make work easier when managing lots of servers. However, it was an interesting challenge, so I decided to investigate and try to determine the best way to do this.

This articles walks through a bit about the PoSh environment within SQL Agent and how you you can more easily run PowerShell code, with parameters.

Where Am I?

The first