Comparing Python and PowerShell DBA Scripting…

 

This is a very good article comparing both Powershell and Python for DBA standard tasks.

The examples taken are :

Nothing earth shattering here, but I hope that you will find them useful. They are

  1. Listing installed hot fixes, i.e. DST patch
  2. Checking free space on drives.
  3. Finding a database across multiple servers
  4. Checking the version of SQL Server installed

PowerShell appears from far as the most concise of both.

Here is the conclusion :

I'm pretty excited about what PowerShell offers. I'm beginning to think it's easier to get things done with it and it looks like you can get more done with fewer lines of code using PowerShell. I found Python a bit easier to read initially but I'm getting used to the PowerShell syntax with the help of Bruce Payette's PowerShell book and several PowerShell blogs and forum posts. Plenty of support has built up around PowerShell that helped me to write this article both from Microsoft and PowerShell users. One thing I won't forget is Gert Drapers saying during his conference presentation that prior to PowerShell he used Perl for his admin scripts. It obvious from Bruce Payette's book that Microsoft did take a significant amount of inspiration from languages like Python and Perl to build PowerShell. No matter which scripting language you choose, I think to be really effective in a large environment you must learn to script. I'm hooked on PowerShell because of what it can do to make my life simpler in our Microsoft environment but also the exposure to .Net and WMI that it provides for a DBA.

And the full article is here : https://www.simple-talk.com/sql/database-administration/comparing-python-and-powershell-dba-scripting-/ _us

image