Recently I found myself looking to automate a process that would connect to a database server and run a bunch of queries and return the results of SET STATISTICS IO for each one. I could certainly load my scripts into SSMS and output the results to a text file, but I wanted to leverage Powershell(…)