none
Using VB.NET to create SQL server group and registered servers RRS feed

  • Question

  • Hi,

    Is there any way to use VB.NET to create SQL server groups and registered servers. Please help me. thank you.


    aan

    Saturday, December 30, 2017 7:52 AM

Answers

  • Hello,

    First off you need to be in the sysadmin group before going down this road.

    You will need to use the RegisteredServer class in Microsoft.SqlServer.Management.RegisteredServers namespace to create groups.

    The very basics to start

    Requires the following references

    Imports Microsoft.SqlServer.Management.Smo
    Imports Microsoft.SqlServer.Management.Smo.RegisteredServers

    Namespace Demo
        Public Class SMOcls
            Public Function RegisteredServersSearch() As Boolean
                Dim rsc As RegisteredServerCollection = SqlServerRegistrations.RegisteredServers
                Return True
            End Function
        End Class
    End Namespace
    

    Documentation.

    Personally I would not go down this path but instead do this in SSMS (SQL-Server Management Studio). SMO (SQL Server Management Objects) is great for getting information, doing backup/restore operations, creating databases and tables in code, that's about it as demonstrated in on of my MSDN code samples (but done in C#) 


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    • Marked as answer by aan_sun Sunday, December 31, 2017 6:44 AM
    Saturday, December 30, 2017 10:35 AM
    Moderator

All replies

  • From what scoop are you asking this. I ask this because at least you need knowledge of other tools which do that, other wise you are creating something like this. 

     


    Success Cor

    Saturday, December 30, 2017 8:24 AM
  • Hi,

    Is there any way to use VB.NET to create SQL server groups and registered servers. Please help me. thank you.


    aan


    SQL Server groups and registered users? What are you talking about?
    Saturday, December 30, 2017 8:41 AM
  • Hello,

    First off you need to be in the sysadmin group before going down this road.

    You will need to use the RegisteredServer class in Microsoft.SqlServer.Management.RegisteredServers namespace to create groups.

    The very basics to start

    Requires the following references

    Imports Microsoft.SqlServer.Management.Smo
    Imports Microsoft.SqlServer.Management.Smo.RegisteredServers

    Namespace Demo
        Public Class SMOcls
            Public Function RegisteredServersSearch() As Boolean
                Dim rsc As RegisteredServerCollection = SqlServerRegistrations.RegisteredServers
                Return True
            End Function
        End Class
    End Namespace
    

    Documentation.

    Personally I would not go down this path but instead do this in SSMS (SQL-Server Management Studio). SMO (SQL Server Management Objects) is great for getting information, doing backup/restore operations, creating databases and tables in code, that's about it as demonstrated in on of my MSDN code samples (but done in C#) 


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    • Marked as answer by aan_sun Sunday, December 31, 2017 6:44 AM
    Saturday, December 30, 2017 10:35 AM
    Moderator
  • Thanks, Karen, I will try using these classes.



    aan

    Sunday, December 31, 2017 6:43 AM