Custom Fields & Batch Edit

avatar

Hey guys,

right now, the only option is to batch ALL edit custom fields at the same time. Let's estimate that I have about 400 entries. Is there the possibility to add a cuistom field 1 with a specific value to EVERY entry without touching other custom fields like number 2/3/4/5?

Aaaand in addition to this: it would be great if there were the option "with overwrite". For example I have 3 entries. Two of them already have values in custom field 1 and the third one don't have any values. I would like to select all three servers and just edit the value with option "dont overwrite"....this could make the handling a lot easier.

I've already tried to look into the database, take the Connections table, parse it to XML, insert the custom fields and write it back to an nvarchar entry within the connection table....this method failed badly :(

Regards

All Comments (3)

avatar

Hello Martin,

for your first point - it is possible with the feature Batch Edit => Custom PowerShell command to edit only specified values - for you scenario the following command schould work:

Select all your session that you want to edit => Right Click => Edit => Edit (Special Actions) => Custom PowerShell Command =>


$connection.MetaInformation.CustomField1Value = "Min Destens"
$RDM.Save();


Regards,
Min

avatar

Hey Min,

indeed, this method is working. I configured the commands slightly for my needs:
(if anyone else has problems like this heres the code)



# Just changing windows and unix entries - skipping SCP, S3, folder etc.
if ($connection.ConnectionType -eq "RDPConfigured" -or $connection.ConnectionType -eq "SSHShell" -or $connection.ConnectionType -eq "Putty")
{
# custom field 1
if ($connection.MetaInformation.CustomField1Title -eq $null -or $connection.MetaInformation.CustomField1Title -eq "" )
{
$connection.MetaInformation.CustomField1Title = "service_description"
}

if ($connection.MetaInformation.CustomField1Value -eq $null -or $connection.MetaInformation.CustomField1Value -eq "" )
{
$connection.MetaInformation.CustomField1Value = "unknown"
}

#if values have to be changed
#$connection.MetaInformation.CustomField5Value = $connection.MetaInformation.CustomField5Value -replace "testValue1","testValue1"

$RDM.Save();
}



Thank you very much for answering quickly!

Let's try on Monday some more complex queries ;)

Regards,
Martin

avatar

Hi Martin,

glad it's working. Thanks for sharing your script with the community! ;)

Have a nice weekend!

Regards,
Min