The below is an example PowerShell script to connect to a Microsoft SQL Database and dump the results of a query into a CSV file.

You will need to change the variables at the top along with the column names against the line starting “$DataSet.Tables[0] | select”

 

 

Author: Phil Eddies

I am an IT Operations Manager, managing all aspects of the IT infrastructure and service for a mid sized UK based company. I have been working full time in IT since 2001 in 1st to 3rd line and System Administration roles. MCSA, MCSE, CCNA, Citrix CCA