Managing Registered servers with SQL Powershell

  • Comments posted to this topic are about the item Managing Registered servers with SQL Powershell

  • Cool, thanks, I'll give it a try.

  • This is a real timesaver, thanks for sharing 🙂

  • Not quite sure why you didn't do the whole thing in PS. Couldn't you have just used a PS array (you could . source it)? Or even a csv file if you want to store the data away from the code?

  • I could have done it like that, but this code is part of the monitoring & registration toolkit my collegues and I have written. I found it more convenient to be able to do this all in management studio

  • arco.scheepen (10/25/2016)


    I could have done it like that, but this code is part of the monitoring & registration toolkit my collegues and I have written. I found it more convenient to be able to do this all in management studio

    Playing the devil's advocate, you could do it all in PowerShell and do it all from SSMS (Powershell prompt)

  • http://www.sqlservercentral.com/articles/Registered+Servers/147023/

    Managing Registered servers with SQL Powershell

    By Arco Scheepen, 2016/10/25

    what do you mean????? "The code below clears the Local Servers Group completely (be aware of this),"???

    can I run it without this clearing of the LSG????

    'dir -Recurse | Remove-Item -force; #clean up everything' + CHAR(13) + CHAR(10)

    Local Servers Group??? that's on AD as a GPO, or Group or Container right???

    Thanks

  • I built the code with a bit of a brute force design. The dir -recurse | remove command clears the local servers list completely, and I rebuild the list again.

  • trangen1 (10/25/2016)


    http://www.sqlservercentral.com/articles/Registered+Servers/147023/

    Managing Registered servers with SQL Powershell

    By Arco Scheepen, 2016/10/25

    what do you mean????? "The code below clears the Local Servers Group completely (be aware of this),"???

    can I run it without this clearing of the LSG????

    'dir -Recurse | Remove-Item -force; #clean up everything' + CHAR(13) + CHAR(10)

    Local Servers Group??? that's on AD as a GPO, or Group or Container right???

    Thanks

    It's the Local Servers Group stored locally in your SSMS instance. Don't think it has anything to do with AD.

    Although it will remove anything the customer/user has added themselves.

    Running it without clearing first will probably blow up.

  • Thanks SSCrazy!!!

  • yes, I'm a NEWB, I've been following SQLServerCentral for a while, just never encountered a situation where I needed to ask a question until now.

    I hope you guys post more"SQL Powershell tips" I love it!!!!!

  • Hi Grasshopper,

    yes, but I'm in Database "Security" so my purpose to run the code is to audit it, I don't want to damage or delete anything, because I'm not going to-and-don't-want-to REBUILD anything.

    I just want a list of the servers, is my intent.

    So how do I do that without "clearing" the 'local server group'????

    Thanks

Viewing 12 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic. Login to reply