Last active
September 5, 2018 16:51
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# 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