Update tags dynamically

2 votes

avatar

Hi,

Is there a way of updating tags for entries dynamically?
We have many VMs hosting many various services
We'd like to update the tags for these VMs in RDM dynamically based on our service deployment map
Is there a built in way we could do that?

If there's no built in way - can you suggest a way to do it by manually (script) updating the tags per VM directly in the data source DB (MSSQL in our case)?

Thanks & Best Regards,
Arik

All Comments (3)

avatar

Hello Arik,

We don't have such a feature at the moment in RDM, but we do have a Powershell module. You can read more about it in our documentation here: https://docs.devolutions.net/powershell/rdm-powershell/powershell-scripting/

This might be a good start for you. Let us know if this answers your needs, otherwise we would need more information to be able to implement a new feature (for example, is there an API or an export of some sort to get the data from this service deployment map?).

Regards,

Hubert Mireault

avatar

I also forgot to mention, but we have synchronizers as well: https://docs.devolutions.net/rdm/concepts/advanced-concepts/synchronizers/

I know we have a few that support importing tags (like the EC2 synchronizer), but if for example you`re using Active Directory and the synchronizer does what you need, we could implement a way to synchronize the tags as well.

Regards,

Hubert Mireault

avatar

Here is some sample code I got from support on working with tags in RDM using the powershell module:

$ds = Get-RDMDataSource -Name " " # <---- Add your Data Source name appearing in RDM
Set-RDMCurrentDataSource $ds

$rdp = Get-RDMSession | Where-Object {$_.ConnectionType -eq " "} # <---- Add the Type of the Entry you want to add/modify the Tags e.g RDPConfigured or SSHSHELL

foreach ($session in $rdp){

$session.MetaInformation.Keywords = " " # <---- Add the name of the Tag

Set-RDMSession $session
}

Write-Host "Done!"
Update-RDMUI

A couple notes:

  1. When you set the keywords it overwrites anything you already had. You can do $tags = $session.MetaInformation.Keywords and use that as a variable when adding your tags back
    1. When you do the $tags= above you will get a single string with all your tags in it separated by spaces, you can use a split command in PowerShell to split them into an array if so desired
  2. When adding keywords I've just been doing "tag1" "tag2" "tag3" not sure if there is a more efficient way


The way I plan to use this is to parse the group name and use key words from it. Now that you mention it, I might want to use PowerCLI and grab tags for VM's and put them into RDM as well, thanks for the good idea.