Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nanoDBA/54e39a66007e0d979149a6b3a4545b59 to your computer and use it in GitHub Desktop.
Save nanoDBA/54e39a66007e0d979149a6b3a4545b59 to your computer and use it in GitHub Desktop.
Attempting to Compare sp_configure differences between two instances - TODO: need to change into a function
<# To compare two server configs ( sp_configure ) #>
# https://sqldbawithabeard.com/tag/sql-dba/
# https://dbatools.io/functions/get-dbaspconfigure/
$oldProps = Get-DbaSpConfigure -SqlInstance 'SERVER01' # | Sort-Object ConfigName
$newProps = Get-DbaSpConfigure -SqlInstance 'NEWSERVER-02' #| Sort-Object ConfigName
$propCompare = foreach ($prop in $oldprops) {
if (($prop2 = $newprops | Where-Object DisplayName -EQ $prop.DisplayName) -AND ($prop2.RunningValue -NE $prop.RunningValue)) {
[pscustomobject]@{
Config = $prop.DisplayName
$($prop.SQLInstance) = $prop.RunningValue
$($prop2.SQLInstance) = $newprops | Where-Object DisplayName -EQ $prop.DisplayName | Select-Object -ExpandProperty RunningValue
}
}
}
$propCompare | Out-GridView
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment