Adding tags (or IP addresses) enmasse

Resolved

Adding tags (or IP addresses) enmasse

avatar

An odd situation I'm not sure how to address.

I rely on the search feature with RDM as I have hundreds, sometimes thousands of session in different vaults. For example, I have one client with about 3K servers. I sync the servers into RDM which is great. However, there are some difference in these servers I would like to identify. I can add a tag and that helps, but when I need to add that tag to twenty servers in different OU's and locations, this becomes a very mind numbing task, especially if done one a regular basis.

Is there a way to feed a list of servers to either the GUI or using powershell so that I can identify these servers and then add a specific tag?

More details. Of the 3k servers, there are 40 of them that are manually provisioned. I may need to log onto these 40 servers to perform a certain task (like change a registry key) or run a script against. If I can type the tag into the search bar -poof! They are all listed where I need them, regardless of OU or location in the RDM structure.

I have other tools that I can export a list of the specific servers but I don't know how to integrate the knowledge from the other tool into the RDM. In theory, I could import them into a specific folder but then I have duplicates. It would also be nice if I could use that tool to replace the session host with an IP address because one client has a global DNS infrastructure that does not work very well.

Thank you.

To say can't is to fail before you begin

All Comments (7)

avatar

Hello Bill,

You would first need to use the advanced search to get the required servers - https://docs.devolutions.net/rdm/windows/commands/view/panels/search/advanced/

You can then apply a tag with the custom PowerShell command for multiple entries at the same time - https://docs.devolutions.net/rdm/windows/powershell-scripting/custom-powershell-commands/

For example (this would replace any existing tag):

$connection.MetaInformation.Keywords = 'new-tag';
$RDM.Save();


This can also be used directly in the Devolutions.PowerShell module, by searching for the entries, applying the tag, and saving them if you do not wish to use the GUI.

Best regards,

Richard Boisvert

avatar

Awesome thank you.

To be a little more clear I'm not pulling the list of servers from RDM, I have a list there that is synchronized with Active Directory (and since DNS is borked it doesn't work well). I am exporting a list from a management console, or using a powershell command and dumping that list into an Excel file because that console allows me to identify specific properties of servers (such as manually provisioned versus cloned). Both system types are in various OU's and there is not a consistent naming pattern.

Perhaps I could export excel to XML and load that in the advanced search? If I could do that then I could easily tag them all in RDM.

Essentially, I dump a list of servers into excel, fliter on the properties I want and then I can cut and paste those systems into notepad or excel. So I need a method to match names from my list with names inside RDM and then apply the tag.

Is that doable?

Thank you.

To say can't is to fail before you begin

avatar

Hello Bill,

Using the PowerShell module, you could. My simple example will assume your entries are all in the same vault, that the name only exists once, and the CSV only has a Name header.

if(-not (Get-Module Devolutions.PowerShell -ListAvailable)){
    Install-Module Devolutions.PowerShell -Scope CurrentUser
}

# Adapt the data source name
$ds = Get-RDMDataSource -Name "NameOfYourDataSourceHere"
Set-RDMCurrentDataSource $ds

#Change to the correct vault
$Vault = Get-RDMVault -Name "Vault-name"
Set-RDMCurrentRepository -Repository $Vault

#Read the CSV, retrieve the associated entry, and update the tag
Import-Csv "path\system.csv" | ForEach-Object {
    $Session = Get-RDMSession -Name $($_.Name)
	$Session.MetaInformation.Keywords = 'new-tag'
	Set-RDMSession $session
}

#refresh the entries
Update-RDMEntries


Best regards,

Richard Boisvert

avatar

Thank you very much. That is awesome. I will give it a try.

To say can't is to fail before you begin

avatar

Hello Bill,

My pleasure; let us know if you have any issues!

Best regards,

Richard Boisvert

avatar

Here is the script that ended up working for me;

#Change to the correct vault
$Vault = Get-RDMVault -Name "VAULTNAME"
Set-RDMCurrentRepository -Repository $Vault

#Read the CSV, retrieve the associated entry, and update the tag
Import-Csv "C:\Temp\RDM\SessionList.csv" | ForEach-Object {
write-host "Running against: $_.Name"
$Session = Get-RDMSession -Name $_.Name
$tags = $Session.MetaInformation.Keywords
$tags = $tags += ' MCS '
$Session.MetaInformation.Keywords= $tags
Set-RDMSession $session
}

#refresh the entries
Update-RDMEntries

With the C:\Temp\RDM\SessionList.csv being formatted as follows:

Name
Session1
Session2
Session3
etc


Thank you!

To say can't is to fail before you begin

avatar

Hello Bill,

Thank you for sharing it with the community!

Best regards,

Richard Boisvert