Discovering SQL-related cmdlets and modules

In order to be good at working with SQL Server and PowerShell, knowing how to explore and discover cmdlets, snapins, and modules is necessary.

Getting ready

Launch PowerShell ISE as administrator. If you prefer the console, you can also launch that instead, but ensure you are running it as administrator.

How to do it...

In this recipe, we will explore SQL-related cmdlets and modules:

  1. To find out how many SQL-related cmdlets are in your system, type the following in your PowerShell editor and run:
    #how many commands from modules that
    #have SQL in the name
    (Get-Command -Module "*SQL*" –CommandType Cmdlet).Count
  2. To list the SQL-related cmdlets, type the following in your PowerShell editor and run:
    #list all the ...

Get SQL Server 2014 with PowerShell v5 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.