/ComparingSQLServerConfigs_sp_configure-need_to_turn_into_a_function.ps1
Last active Sep 5, 2018
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