x

Powershell Register Servers - How do I add a connection property?

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" ..........

more ▼

asked Oct 19, 2009 at 03:40 PM in Default

avatar image

Mark 1
11 1 1 3

(comments are locked)
10|1200 characters needed characters left

3 answers: sort voted first

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.

http://ssmstoolspack.com

more ▼

answered Oct 19, 2009 at 04:00 PM

avatar image

Jorge Segarra
419 2 4

(comments are locked)
10|1200 characters needed characters left

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)

https://msevents.microsoft.com/cui/WebCastEventDetails.aspx?EventID=1032391436&EventCategory=5&culture=en-US&CountryCode=US

Here's the script you were looking for:

http://blogs.msdn.com/buckwoody/archive/2009/10/14/color-your-connections.aspx

more ▼

answered Oct 19, 2009 at 03:58 PM

avatar image

Jorge Segarra
419 2 4

(comments are locked)
10|1200 characters needed characters left

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 ▼

answered Oct 19, 2009 at 11:43 PM

avatar image

Tim Benninghoff
43 1 1 5

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x417
x51
x23

asked: Oct 19, 2009 at 03:40 PM

Seen: 3908 times

Last Updated: Oct 20, 2009 at 06:03 AM

Copyright 2016 Redgate Software. Privacy Policy