Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.