This function set the appropriate compression recommendation.
Remember Uptime is critical, the longer uptime, the more accurate the analysis is.
You would probably be best if you utilized Get-DbaUptime first, before running this command.
Set-DbaDbCompression script derived from GitHub and the tigertoolbox
Set the compression run time to 60 minutes and will start the compression of tables/indexes that have a difference of 25% or higher between current and recommended.
Set-DbaDbCompression -SqlInstance localhost -MaxRunTime 60 -PercentCompression 25
Set the compression run time to 60 minutes and will start the compression of tables/indexes that have a difference of 25% or higher between current and recommended and the results into a nicely formatted GridView.
Set-DbaDbCompression -SqlInstance ServerA -Database DBName -MaxRunTime 60 -PercentCompression 25 | Out-GridView
Returns results of all potential compression options for all databases with the recommendation of either Page or Row
$cred = Get-Credential sqladmin
Set-DbaDbCompression -SqlInstance ServerA -ExcludeDatabase Database -SqlCredential $cred -MaxRunTime 60 -PercentCompression 25
This command was created by Jason Squires. You can find Jason on Twitter.