Get a ds entry based on custumfield property

Get a ds entry based on custumfield property

avatar

With the remote desktop manager powershell module I can do the following query

    $pwdlist = Get-RDMSession |
    Where-Object {
        $_.Credentials.CredentialType -eq "Passwordlist" -and
        $_.MetaInformation.CustomField1Value -eq $company_id
    } |

    Select-Object Name, Id, Credentials, UpdateDateTime -ExpandProperty MetaInformation

But I want to use the devolution server commands.
Is there a easy way to filter on the MetaInformation.CustomField1Value

With kind regards

All Comments (2)

avatar

Hello,

Upon review, it appears that DS cmdlets do not support the same functionality as required. There are two alternative approaches, though each has significant limitations:

  • Get-DSEntry -EntryID $entryId -AsRDMConnection : This method requires a separate request for each entry, which could be inefficient.
  • Get-DSEntry -VaultID $vaultID -EntryID $entry -FilterBy $by -FilterMatch $match -FilterValue $value : Unfortunately, this option doesn't allow filtering to return every entry within a specified vault.


In both cases, the returned objects will include the custom property value, allowing for further filtering. If you’re interested, I can provide an example to illustrate this.

As an improvement, I plan to update the FilterValue parameter to accept an empty string. This change would make it possible to retrieve all entries in the vault, including all related information and metadata.

I'll keep you informed when this improvement is available.

Best regards,
Maxime

avatar

Hello,

As of version 2024.2.6 of the module, it is now possible to filter by custom field value. Here’s an example:

$vaultId = 'my-vault-id'
Get-DSEntry -FilterBy Name -FilterMatch Contains -FilterValue "" -VaultID $vaultId | Where { $_.Data.Contains('<ConnectionSubType>PasswordList</ConnectionSubType>') -and  $_.Data.Contains('<CustomField1Value>MyCustomField1</CustomField1Value>') }

To manipulate the Data field more easily, you can use the Convert-XMLToPSCustomObject cmdlet.
Let me know if you have any questions.

Best regards,
Maxime