Get-Command in PowerShell

📜Part of the PowerShell Complete Guide, every PowerShell post on this site, grouped by the job you are doing.

Get-Command is a cmdlet in PowerShell that lets you retrieve a list of all available commands in your current session. It’s a go to tool for discovering new commands and understanding their usage and capabilities.


Filtering with Wildcards

You can use Get-Command with wildcards to filter results based on patterns. This is particularly useful when you’re not sure of a command’s exact name but know part of it.

# get-command, better use wildcards *
Get-Command test-sql*
PowerShell Get Command Wildcard

We can list commands that belong to a specific PowerShell module, or that have a specific verb or noun in their name. For example, run Get-Command Test-* to retrieve all PowerShell cmdlets with the ‘Test’ prefix.

This was just a quick post / note of a SQL PowerShell get-command cmdlet example. Hope it was useful!

If SQL Server is part of your day job, my current work lives over at sqldba.blog: production DBA scripts, an error library and the SSMS guide.


Comments

Leave a Reply

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

Looking for SQL Server?

This site started as a SQL Server blog in 2017 and the archive is still here. The new SQL Server writing, and all the scripts, moved to a site of their own.

sqldba.blogScripts, error library, wait types, SSMS
Browse by topic