Powershell Scripting: Invoke-ECSSQLQuery

Quick Powershell post for those of you that may on occasion want to retrieve data out of a SQL table via Powershell. I didn’t personally do most of the heavy lifting in this, I simply took some work that various folks out there did and put it into a repeatable function instead.

Firstly, head over to here to my GitHub if you want to grab it. I’ll be keeping it updated as change requests come in, or as I get new ideas, so make sure if you do use my function, that you check back in on occasion for new versions.

There is also an optional “timeout” parameter that can be used for really long running queries. By default its 30 seconds, you can set it as high as you want, or specify “0” if you don’t want any timeout.