dbatools is a free PowerShell module with over 180 SQL Server administration, best practice and migration commands included.


Get-DbaQueryStoreConfig

Get the Query Store configuration for Query Store enabled databases. Retrieves and returns the Query Store configuration for every database that has the Query Store feature enabled.

Screenshots

Examples

Returns Query Store configuration settings for every database on the ServerA\sql instance.

Get-DbaQueryStoreConfig -SqlServer ServerA\sql

Returns the Query Store configuration for all databases on ServerA\sql where the Query Store feature is in Read/Write mode.

Get-DbaQueryStoreConfig -SqlServer ServerA\sql | Where-Object {$_.ActualState -eq “ReadWrite”}

Returns Query Store configuration settings for every database on the ServerA\sql instance inside a table format.

Get-DbaQueryStoreConfig -SqlServer localhost | format-table -AutoSize -Wrap

Author

This command was created by Enrico van de Laar. You can follow Enrico on Twitter at @evdlaar.

Get-Help

From PowerShell, execute Get-Help Get-DbaQueryStoreConfig -Detailed for more information on this function.

Source Code

Want to see the source code? View Get-DbaQueryStoreConfig.ps1 on GitHub
 

Related commands