I have a little PS script that Buck Wooody posted a while back. I use it to generate a refreshed list of registered servers in a given server group. I would like to add the Custom Color property to the script but haven't been able to find it anywhere. Any help would be appreciated.
This is the script:
cd 'SQLSERVER:\sqlregistration\Database Engine Server Group' rm group_name -recurse new-item group_name cd group_name new-item SERVERNAME -itemtype registration -Value "server=SERVERNAME;integrated security=true" ..........
Answer by Jorge Segarra ·
I'm trying to find the recording for the webcast where Buck demonstrates this. Here's one I've found so far (will edit with more links later)
Here's the script you were looking for:
Answer by Tim Benninghoff ·
I found this same code on Bob Beauchemin's blog.
Anyway, since you're creating a registration item, you should be able to get your new registration as an object immediately after you create it:
$srv = get-item SERVERNAME;
Once you have this object, you can then theoretically use it's methods to change it's properties through SMO:
--I took the values for these functions from an existing registration I made in SSMS. The ColorArgb is supposed to be green.
However, Bob's note at the bottom of his blog post about the changes made in PowerShell not showing up immediately in SSMS seem to be the case whenever I test. In fact, I can never seem to get the changes to show up in SSMS...ever.
I'm happy to be proven wrong, but my guess is that the new-item cmdlet doesn't quite make the Registration properly enough that you can modify it's properties through SMO.