I am wondering how is powershell used in SQL Server? I heard people saying that powershell makes a DBA's life easier. But I dont know how is powershell commonly used in SQL server. Can anyone provide me insights or links as to how powershell is being used in SQL Server?


So the main thing is that you can set these up to be dynamic. You wouldn't have to log into each instance to find out the settings. It does make it easier to perform a health check and just keep track of the lot. I used it for Parsing Excel documents to SQL server. This turned out to be very simple instead of converting it to csv documents and importing from there.

But what I would do is check into this site, it has a pretty good repository. A bit old though...

Additionally, Microsoft is making a huge amount of enhancements to powershell into SQL server. It was ignored previously as it was already a scripting language. Most people now are going into proper desired state configuration where you can spin up a SQL server instance with memory and all the settings you would like inside the SQL server instead of it just setting up the windows box and you needing to log into the SQL instance to run scripts. Pretty good post about it here.

| improve this answer | |
  • In a perspective of multiple servers (install/update multiple instances) it's the best tool. – Pedro Faro Apr 22 '16 at 21:43
  • thanks for sharing. Do you mind posting a link on a guide how to do that? greatly appreciate it – Keith Rivera Apr 23 '16 at 1:37
  • Not that this is a bad answer but you only pointed out probably 0.5% of what I use PS for with SQL Server. Also the site you noted, viewing a handful of that author's script is just executing T-SQL via a PS script and didn't see one utilizing SMO which is more common. – user507 Apr 24 '16 at 2:39

Not the answer you're looking for? Browse other questions tagged or ask your own question.