I wrote a script that creates a "Registered Server" group and then a "Server Registration" for each of the servers found in a text or csv file. This comes in handy when you want to create lots of registrations (groups and/or servers).
Basically, to use the script, you create a file (txt or csv) for each group you want to add in "Registered Servers". The script can be run against a folder or a file, so if you want to create all groups at one time you can put all the files in one folder and the script will process each file in the folder. The name of the file is the name of the group you'll create, i.e., if I wanted to create a group named "ConfigMgr SQL Servers" I'd create a file named "ConfigMgr SQL Servers.txt" or "ConfigMgr SQL Servers.csv". Within this file I'd add a line for each server I want to add in the group, and then I could run the PowerShell script which would create the group and all the servers that were in the file.
In addition to the comments and examples in the script, let me try to explain the CSV file formats that are accepted by the script. The txt or csv file(s) must have at least a "SQL Server Name" in order for the script to work correctly. But, it can have additional properties as well as long as they follow this format: ServerName,DatabaseName,DisplayName,ConnectionString (or Connection String Options to add to the connection string). Perhaps the best way to do this is to show examples; here I created a csv file with some fake servers and named the file "Example Group For Blog.csv":
Next, I'll run the following command (notice that I'm using the "HasHeaderRow" flag because I do have a header row in the csv file):
& 'C:\LocationWhereTheScriptIsStored\CreateSqlServerRegistrationsInSSMS.ps1' -Path "F:\Example Group For Blog.csv" -HasHeaderRow
You can see that each of the servers listed in the csv file was created within the group. And, to show the properties from the UI for each of the registered servers to help make sense of how the properties were used:
Does that help explain without words? Hopefully. The rest of the functionality should be fairly well documented in the script comments itself, so please make sure to read those.
The blog platform seems to strip out the help comments when I try to paste the code directly in this blog using 'code' blocks so here is a OneDrive link to the script. And, here's a link to the OneDrive folder which contains the script as well as the example csv for reference.
If you find any issues or have some improvements please let me know (and share the updated script!) :).