|
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:
(comments are locked)
|
|
Answering separately since this is a complete other solution but you can install SSMS Tools pack (its free) and get that same functionality without having to code at all. I have the tools pack. It colors the Query just under the tab and colors are different for each query. The Custom Color on the Connect property is the connection information at the bottom of the Query. I have setting up a color for Production servers (red), a color for Dev servers (green).
Oct 19 '09 at 04:16 PM
Mark 1
(comments are locked)
|
|
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: http://blogs.msdn.com/buckwoody/archive/2009/10/14/color-your-connections.aspx
(comments are locked)
|
|
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: $srv.set_UseCustomConnectionColor($True); $srv.set_CustomConnectionColorArgb(-16711936); --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. More testing: I notice that those properties, UseCustomConnect ionColor and CustomConnectionColorArgb, have reset back to their defaults (False and 0, respectively) once I leave PowerShell and then restart PowerShell.
Oct 19 '09 at 11:54 PM
Tim Benninghoff
Thanks Tim - I played with it a bit and can't make it "stick" either.
Oct 20 '09 at 11:42 AM
Mark 1
(comments are locked)
|

