Show-Command + dbatools = Awesome scripts2 min read

There is a little known or used command that can grant you great power when it comes to running PowerShell commands.

The Show-Command cmdlet will display in a graphical interface all the parameter options related to a function, cmdlet or workflow.

I always recommend the book “Learn Windows PowerShell in a Month of Lunches” for people that ask me how to get started with PowerShell.  It is a very thorough book and I believe helps build the foundation you need to user PowerShell to the fullest.  Earlier this month I spent time going through the book for maybe the third time.  I must have blown right by the Show-Command cmdlet which shows up in Chapter 4, as I do not ever remembering seeing it before.  Then a couple of weeks ago Kenneth Fisher ( b | t ) post a blog about this command.  I like how Kenneth related the Show-Command in PowerShell to generating scripts with SSMS.  This is a great comparison for the DBA to understand.  After reading his blog post I thought, wow, this might be a handy tool to combine with my favorite module out there dbatools.

Here is what I found that makes combining these items make life so much easier.

If you take a look at the Start-DbaMigration function which is the foundation of dbatools you will see all the options possible.

Now you can easily see all the parameters available to this function and enter the values you want or check the boxes that relate to you.  If you click Run the command and parameters will be put on your active PowerShell console command line.  If you choose Copy the command and parameters will be placed on your clipboard so you can paste them in a script or document.

No more hunting through the

For the parameter list to see what is available to you.  This will show you what you have and how to use it just like that.

I want to thank Kenneth for his blog pointing me to this command.  I think this is such an awesome use of a cmdlet to help you enhance the use of functions and modules.  Again, this just shows the power of PowerShell and how it can be leveraged.


Leave a Reply

Your email address will not be published. Required fields are marked *