Resolved

Change password

avatar

Hi i am new to this Vpn how to change password

All Comments (4)

avatar

Hello,

You can use the following to modify a password:

$Entry = (Get-DSEntry -EntryId $EntryId).Body.data
$Entry.data.passwordItem = @{
    hasSensitiveData = $false
    sensitiveData = $YourNewPassword
}        
Update-DSEntryBase (ConvertTo-Json $Entry -Depth 10)


For more information on connecting to the Devolutions Server with the PS module, please refer to https://docs.devolutions.net/kb/devolutions-server/how-to-articles/create-server-data-source-application-key/#method-2-powershell

Best regards,

Richard Boisvert

avatar

Hello, is this method still available in version 2024.2.5 ?
I get this error while trying to update the password of an entry :
cf3ecf15-4254-4e8a-9b04-0fcda3c6735d

Here is my code:
7fa7c537-e745-43b3-89fa-7d018fb845de
Thanks

7fa7c537-e745-43b3-89fa-7d018fb845de.png

cf3ecf15-4254-4e8a-9b04-0fcda3c6735d.png

avatar

Hello,

In version 2024.2.0, the behavior of object returns has changed. Now, the object is returned directly unless you use the `$AsLegacyResponse` switch, which reverts to the previous behavior. Additionally, using the `FilterBy` parameter returns a different object compared to when you use the `ID` parameter, so it's important to be aware of this distinction.

Here is a working example, assuming the name is unique:

$vaultId = 'my-vault-id'
$name = 'name to search'
$s =  Search-DSEntry -By Name -Match ExactExpression -Value $name -IncludeVault $vaultId
$entry = Get-DSEntry -EntryID $s.id
$entry.data.passwordItem = @{
    hasSensitiveData = $false
    sensitiveData = $YourNewPassword
}        
Update-DSEntryBase (ConvertTo-Json $Entry -Depth 10)


If you need further help, let us know.

Best regards,
Maxime

avatar

Hello Maxime, thanks for your help it works great with your code.
👍