Support

Support forum for Devolutions PowerShell

avatar

Maurice Côté

Introduction of our GitHub repository for samples and scripts

Hi All, This forum has served its usefulness for a long time but it is now becoming harder to find up-to-date information. Older topics contain instructions that have been deprecated over time and this may send you down the wrong path on achieving your goals. Questions and requests for samples should still be posted right here, but the Devolutions Team will most likely respond with a link to the proper script in the GitHub repo. The repository can be found at https://github.com/Devolutions/RDMSamples-ps , please watch it or, even better, star it so we have an idea of how many of you are using it. Happy scripting!

2151

7

avatar

Erica Poirier

avatar

Timo

Set macro password

Hi! First as context: I want to execute a command on a remote host. Actual solution is a ssh session with an "After open" macro and closing this session after execution. The command has an password as parameter. Using a linked entry, does not work, so I want to set the macro password with an powershell script. How can I set the macro password with a powershell script? The secure password is stored in $session. Events.AfterConnectionTypingMacroSafePassword but setting does not work. I know the Set-RDMSessionPassword command. Is there something simmilar for the macropassword? CU, Timo

488

11

avatar

Jacob Lafrenière

avatar

ronbouwmeester

Resolved

Import Custom variable into Devolutions Hub Business

Good afternoon, Is it possible to import Custom variables into a Hub Business environment using PowerShell? Kind regards, Ron Bouwmeester

Recommended Answer

13 days ago

Hello, It is possible to import custom variables into a Hub Business environment using PowerShell, though the current solution is a workaround. You can use the Import-RDMCustomVariable cmdlet, which accepts a JSON file as input. Here is an example of the JSON file format (custom_variables.json): [ { "Name": "CV1", "Value": "Some value", "Description": "my custom variable 1" }, { "Name": "SomePort", "Value": "5432", "Description": "Some port" } ] Import command: Import-RDMCustomVariable -FilePath "C:\path\to\custom_variables.json" -ImportAction ReplaceList -VariableScope DataSource The ImportAction parameter controls how duplicates are handled: ReplaceList — replaces all existing variables with the imported list AddNewItems — only adds variables that don't already exist AddAndUpdate — adds new variables and updates existing ones The VariableScope parameter controls where the variables are stored: DataSource — data source settings Vault — current vault UserVault — current user vault Option — application options Please note that this is a workaround, as dedicated cmdlets for managing custom variables at the vault level are not yet available. A ticket has been logged to add proper cmdlet support for this scenario, and it will be addressed in a future release. Do not hesitate to reach out if you have any further questions. Best regards, Maxime

46

8

avatar

Maxime Bernier

avatar

ronbouwmeester

Resolved

Import .rdm file into Devolutions Hub Business

Good afternoon, Is it possible to import the content of an .rdm file into a Hub Business environment using PowerShell? Kind regards, Ron Bouwmeester

Recommended Answer

13 days ago

Hello Ron, Your script is on the right track, but there are a few things to fix: Missing Set-RDMCurrentDataSource: After retrieving the data source, you need to actually activate it. Without this call, all subsequent commands run against whatever data source was already active. Missing validation: After setting the data source and vault, it is good practice to verify they are correctly active before proceeding. This prevents silently importing into the wrong location. Import-RDMEntry missing -Set: Without -Set, the documents and attachments will not be included. Here is the corrected script: $desiredDataSourceName = "Devolutions Hub Business" $desiredVaultName = "<Vault name>" # 1. Get and activate the data source $ds = Get-RDMDataSource -Name $desiredDataSourceName Set-RDMCurrentDataSource $ds # 2. Validate the active data source $currentDs = Get-RDMCurrentDataSource if ($currentDs.Name -ne $desiredDataSourceName) { Write-Error "Data source mismatch: expected '$desiredDataSourceName', got '$($currentDs.Name)'. Aborting." exit 1 } # 3. Get and activate the vault $repository = Get-RDMRepository -Name $desiredVaultName Set-RDMCurrentRepository $repository # 4. Validate the active vault $currentRepo = Get-RDMCurrentRepository if ($currentRepo.Name -ne $desiredVaultName) { Write-Error "Vault mismatch: expected '$desiredVaultName', got '$($currentRepo.Name)'. Aborting." exit 1 } # 5. Import entries $importedEntries = Import-RDMEntry -Path "<Path>\<FileName>.rdm" -Set Write-Host "Imported $($importedEntries.Count) entries." This script has been tested and works correctly. Just replace <Vault name>, <Path>, and <FileName> with your actual values. Best regards, Maxime

43

7

avatar

Maxime Bernier

avatar

yannickhein

Retrieve secured command parameter as plain text

We have quite a few automatically generated "CommandLine" type entries in RDM which I would like to access via PowerShell. The entries have 4 default parameters which are all of type "secured", so I get this result when accessing it: PS C:\Git> Get-RDMVersion 2025.1.38.0 PS C:\Git> Import-Module Devolutions.PowerShell >> >> $ds = Get-RDMDatasource -Name $dataSourceName >> Set-RDMCurrentDataSource -Datasource $ds >> >> $v = Get-RDMVault -Name $rdmVault >> Set-RDMCurrentVault -Repository $v >> >> $entry = Get-RDMEntry -Group $rdmPath -name $rdmEntry PS C:\Git> $entry.Cmd.Param1Default PS C:\Git> $entry.Cmd.SafeParam1Default /kmQ..... PS C:\Git> The parameters are all shown as "SafeParam1Default" (..4), but the "ParamxDefault" is empty (strangely enough, I changed one entry which is just an IP to type "Text" and it is still shown only as "Safe..." parameter - this might be a bug). I would like to access the parameters as plain text, but did not manage to get "Get-RDMEntryPassword" working here. How get I get this done?

44

2

avatar

Maxime Bernier

avatar

VirTechSystems

Resolved

PowerShell module no longer works

I'm not sure what is going on, but the `Set-RDMSession` cmdlet no longer works. ``` IsConnected : True IsOffline : False Name : Customers Type : SQLServer VERBOSE: [Set-RDMSession] Start Set-RDMSession: Z:\SCRIPTS\powershell\Create-RDMCredential.ps1:77 Line | 77 | Set-RDMSession $cr -Refresh -Verbose | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Your connection is not ready VERBOSE: [Set-RDMSession] Finish ``` I've rebooted the server multiple times, updated RDM, and updated the powershell module with the same result. It's not a permission problem as every other command works and I can do everything manually in RDM itself. Is there any way to figure out why this isn't working? Everything looks like it should work. Thanks, Chris

42

3

avatar

VirTechSystems

avatar

tonyfredriksson

Resolved

Get-RDMOauthToken not working since version 2026.1.0

Hi. Get-RDMOauthToken stopped working since version 2026.1.0 at least, but i tried with the latest 2026.1.2 as well. PS C:\Users\to-fre> Get-Command -Module Devolutions.Powershell | where {$_.Name -match "Get-RDMOAuthToken"} CommandType Name Version Source ----------- ---- ------- ------ Cmdlet Get-RDMOAuthToken 2026.1.2 Devolutions.PowerShell PS C:\Users\to-fre> New-DSSession -BaseURI $DSServerUri -UseOAuth PS C:\Users\to-fre> Get-RDMOAuthToken Get-RDMOAuthToken: The type initializer for 'System.Text.Json.JsonSerializer' threw an exception. PS C:\Users\to-fre> Import-Module -Name Devolutions.PowerShell -requiredVersion 2025.3.4 PS C:\Users\to-fre> Get-Command -Module Devolutions.Powershell | where {$_.Name -match "Get-RDMOAuthToken"} CommandType Name Version Source ----------- ---- ------- ------ Cmdlet Get-RDMOAuthToken 2025.3.4 Devolutions.PowerShell PS C:\Users\to-fre> New-DSSession -BaseURI $DSServerUri -UseOAuth PS C:\Users\to-fre> Get-RDMOAuthToken AccessToken ----------- e........... Br, Tony

Recommended Answer

19 days ago

Hello tonyfredriksson , Version 2026.1.3 of the Devolutions.PowerShell module introduces a fix for this issue; Get-RDMOAuthToken should no longer throw this error when fetching the token. Feel free to contact us if you encounter any other problems. Best regards, Christian

64

3

avatar

Christian Robert

avatar

tblanken

Question Create and Update Entry via Powershell

Hello, we try creating new entries and update via PowerShell. Out current script looks like this: $URL = "https://ourServer"; $pEntryName = "00001" $diag = [ordered]@{} try { # Connect $diag.Session = New-DSSession -BaseURI $URL -WindowsAuthentication # Try get Entry by Name $newEntry = Get-DSEntry -VaultID "00000000-0000-0000-0000-000000000000" -FilterMatch ExactExpression -FilterValue "$pEntryName" if ($null -eq $newEntry){ # Entry not available - Create a new empty Entry inside desired vault $newEntry = New-DSCredentialEntry -Name "$pEntryName" -VaultID "00000000-0000-0000-0000-000000000000" $newEntry.connectionType = 26 # 5 - Website-Type #26 - CredentialEntry # --- User and Password $newEntry.data | Add-Member -MemberType NoteProperty -Name "userName" -Value "MyNewUser" $newEntry.data.passwordItem = @{hasSensitiveData = $false; sensitiveData = "MyNewPassword" } #Convert to Json $newEntryJson = $newEntry | ConvertTo-Json -Depth 100 # Update Entry on Server Update-DSEntryBase -JsonBody $newEntryJson } else{ # Entry available - update password $cred = $newEntry.data $cred.passwordItem | Add-Member -MemberType NoteProperty -Name SensitiveData -Value "MyNewerPassword" Update-DSEntryBase -JsonBody (ConvertTo-Json -InputObject $cred -Depth 4) } } catch { $diag.Error = $_.Exception.Message } $diag.Error When executing: Creation of entry succeeds Update of entry fails Error: … swordItem | Add-Member -MemberType NoteProperty -Name SensitiveData - … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Cannot bind argument to parameter 'InputObject' because it is null. I read from here: https://docs.devolutions.net/powershell/powershell-commands/update-dsentrybase/ Version: Current Version of DVLS, PowerShell-Modules, ... Does anyone can give me a hint? Best regards, Torben

308

16

avatar

Christian Robert

avatar

csudderth

Backlog

Powershell seems to hang when exiting after using a Devolutions.Powershell cmdlet

Powershell hangs whenever I try to exit whenever I have used a Devolutions.Powershell cmdlet during the session. Even when I run New-DSSession with invalid credentials and never actually make a connection, it makes Powershell freeze on exit. I first noticed this in a Gitlab CI/CD pipeline on a Linux Docker runner. The Powershell script would run successfully but would hang indefinitely at the end sometimes. Others, it would end just fine. I was able to recreate this on my Macbook as well. All I did was attempt a New-DSSession and it would intermittently hang when trying to exit. There doesn't seem to be any consistency or pattern to it unfortunately. The only workaround that has been successful is using [Environment]::Exit(0) to forcefully exit instead of exiting normally. Is this a known issue? I'm happy to provide any further debugging details if possible.

144

5

avatar

csudderth

avatar

davidwillis

Data Source Auto-Refresh Settings

Hello, I have a couple questions about how the auto-refresh works with a SQL Server data source. I notice there are a few settings that may play a role. Data Source Settings -> Settings tab -> Ping online method [image] Data Source Settings -> Advanced tab -> "Sync all vaults (background)" and "Auto-refresh": [image] File -> Background Services -> Is online tab -> "Enable checking for server availability" and "Check if the host is online": [image] How do all these work together? What is the difference between "checking for server availability" and "checking if host is online" in the last example? And what do the various settings mean on "sync all vaults (background)" dropdown in the second example? Sorry I know this is a multi-part question, and maybe some of these are for something else/do not relate to data source refresh. But I'm just wondering how this process works. Thanks!

152

5

avatar

Jacob Lafrenière

avatar

kiaarmani

Resolved

Powershell - Unable to create repository using application identity

Hello there, I am currently trying to migrate an existing script that performs batch operations from using a username and password to using an application identity. The script should create a repository using a given name, using an existing repository as template. Logging in has worked so far: $appId = $ScriptConfig.ApplicationId $appSecret = $ScriptConfig.ApplicationSecret if ([string]::IsNullOrWhiteSpace($appId) -or [string]::IsNullOrWhiteSpace($appSecret)) { throw "ApplicationId and ApplicationSecret must be configured." } if ($OverrideOptionFilePath) { $optionDir = Split-Path $OverrideOptionFilePath -Parent if ($optionDir -and -not (Test-Path $optionDir)) { New-Item -ItemType Directory -Path $optionDir -Force | Out-Null } $override = Get-RDMPowerShellOverride $override.OptionFilePath = $OverrideOptionFilePath Set-RDMPowerShellOverride } Write-LogSimple -Message "Connecting to $DvlsUrl with application id '$appId'..." -Type "INFO" $ds = New-RDMDataSource -DVLS -Name $ScriptConfig.DataSourceName -Server $DvlsUrl -ScriptingTenantID $appId -ScriptingApplicationPassword $appSecret -SetDatasource -WarningAction SilentlyContinue Set-RDMDataSource $ds Set-RDMCurrentDataSource $ds Unfortunately, trying to create a repository using the same login, yields in "Session does not seem authenticated" errors. New-DSVault -Name $NewRepositoryName -ErrorAction Stop -SecurityLevel "Standard" -IsAllowedOffline $true -AllowedRolesList ("ROLE_01", "ROLE_02") I read in the documentation that application identities have no permissions by default, but I am unsure how I would give it permission to create the vault. Here are my system permissions: [image] What permissions do I need to set / grant for this to work?

189

8

avatar

kiaarmani

avatar

James Schlackman

Powershell terminal entries do not run if the script contains a #Required directive

I started using Devolutions RDM recently and have been adding some of my commonly-used scripts as PowerShell terminal (local) entries, but I've discovered that RDM will not run any script that includes a #Requires directive, e.g. #Requires -Modules ExchangeOnlineManagement or #Requires -RunAsAdministrator If such a directive is included in the script, the entry will silently fail when configured for tabbed mode. If set to run in external mode, an exception error dialog is immediately shown when the entry is run: ArgumentOutOfRangeException - startIndex ('-1') must be a non-negative value. (Parameter 'startIndex') Actual value was -1. [image] Is this a bug or is there a configuration change I can make? I did send an error report if that helps.

193

6

avatar

James Schlackman

avatar

dmitzman

Resolved

Set-rdmsession for RDP with a RD gateway

We are preparing to move from straight RDP to utilizing a secure RF gateway. I was able to manually create a session and it worked just fine but we need to migrate all our connections so I was planning to use powershell to script it out. Problem is, I can't find in the documents how to create that object and add it to the RDMSession. Any thoughts or section of the documentation you can point me to?

192

4

avatar

dmitzman

avatar

sjames

Set-RDMUser - changing application access

Trying to work out how I can change these settings back to default Get-RDMUser appears to have boolean settings (true/false) - is there somewhere else it can be set? [image] CreateSQLServerLogin : True HasPrivateVault : False IntegratedSecurity : True Password : ServerUserType : 8 UserType : User CanAdd : True CanDelete : True CanEdit : True CanMove : True ConnectionOverrides : CreationDate : 1/1/0001 12:00:00 AM CustomSecurity : <?xml version="1.0" encoding="utf-8"?> <CustomSecurity> <IntegratedSecurity>true</IntegratedSecurity> <ContainedDatabaseUser>true</ContainedDatabaseUser> </CustomSecurity> DataSourceID : 00000000-0000-0000-0000-000000000000 GroupInfos : HasAccessLauncher : True HasAccessRDM : True HasAccessWeb : False HasAccessWebLogin : True IsAdministrator : False IsEnabled : False IsLockedOut : False IsNew : False IsOwner : False IsTemplate : False LastLockoutDate : LoginEmail :

190

2

avatar

Patrick Ouimet

avatar

bjoernramann

Get logs with Get-HubSiemLogs

Hello, I try to get our Hub-logs to transfer them into our Siem. To do this, in my script I first logon with a appkey and this looks ok because I get data with "Get-HubSystemSettings". When I try to use Get-HubSiemLogs, I get always: The api call with Hub failed. (Forbidden). To configure the access via powershell I found this docs: https://blog.devolutions.net/2021/05/new-feature-password-hub-business-powershell-module/#access-password-hub-business-with-hub-powershell-module https://docs.devolutions.net/server/web-interface/administration/security-management/applications/ What need I to do to get the logs? Thanks Bjoern

207

4

avatar

Patrick Ouimet

avatar

miccol

Resolved

Import Azure AD groups

I'm trying to fully automate the Vault creation process. To grant access to vaults I use Entra ID groups. When creating new vaults manually, I simply go to User Groups, hit "Import" then select "Azure Active Directory", filter for a certain name standard and then hit import. I then go about assigning permissions later on. I'm struggling to figure out how to automate the step above. Creating a vault is easy, assigning permissions likewise, but importing Entra ID groups...how to do that? Thanks.

211

5

avatar

miccol

avatar

Joffrey

Update token for hashicorp credential

Hi, How can I update the token for connectiontype "credential" and credentialtype "hashicorpVault" ? I tried set-rdmentrypassword , no change. thanks you The xml is: <?xml version="1.0" encoding="utf-8"?> <RDMExport> <Connections> <Connection> <ConnectionType>Credential</ConnectionType> <ID>2fbbe2fb-1f05-4d8a-9f93-34a5a8374c8c</ID> <Name>MY-VAULT</Name> <Credentials> <CredentialType>HashiCorpVault</CredentialType> <HashiCorpVaultAlwaysPromptWithList>true</HashiCorpVaultAlwaysPromptWithList> <HashiCorpVaultServer>https://my.vault.server</HashiCorpVaultServer> <SafeHashiCorpVaultToken>b3f90GoGTtHARPA76il/NDUIc+B3v9N8Qa5hZP8ROw3LvrWfOzFmRjsuA39Hin6OwdzrJbM/8b1ZulIIROEgQ5qb2iZLCfCY7T+dTL4fvwmx8nKw9mvHvISolVYWUGTHHRI6S1emUS0=</SafeHashiCorpVaultToken> </Credentials>

160

5

avatar

Joffrey

avatar

vladyslavmiachkov

Backlog

Impossible to create data source when RDM is running via powershell

Hi! I am trying to create data source via powershell. I found out that I can do it when application is not running but when app is running sqlite file or xml file doesnt create. I checked both windows and macOS. Could you check from your side? I suppose that it is a bug. Commands I've used: $s = New-RDMDataSource -SQLite -Database "/usr/local/dev/rdm_test/sqlite_test" -Name "sqlite_test" Set-RDMDatasource $s Update-RDMUI. P.S I tried to attach some screen records but had error on creating post.

223

5

avatar

vladyslavmiachkov

avatar

RDMTinkerer

How to filter AddOn entries?

Hi, I need to fetch all entries of type "Mikrotik Winbox" using PowerShell. I noticed that they have ConnectionType equal to AddOn . But then, how do I filter AddOn of specific type? I can reverse-engineer the GUID in the ConnectionSubType to be 59c4de6b-864c-4dbc-8183-489f40233004 for Mikrotik. But there are 2 questions: Is this the right way of filtering them? Is there a dictionary of the ConnectionSubTypes that I could use, and not do the guesswork? For example if I need to filter specific entries that might not (yet) exist, how can I determine its subtype other than by tedious work of creating a sample entry, and then doing the above again? Thanks.

180

4

avatar

Maxime Bernier

avatar

jordi

Unable to connect to DVLS datasource on "Clean" machine(s)

Hi, i am trying to connect to a dvls datasource with the remotedesktopmanager powershell module on a Clean windows 11 machine (just installed it) and want to connect to DVLS. The error is also appearing on server type os and a VM i work on. I constantly getting an error : DllNotFoundException - Unable to load DLL 'sqlite3secure' or one of its dependencies: the specified module could not be found. (0x8007007E) One side note on the machines i am testing with is that RDM is NOT installed. Because we are trying to automate some workflows i dont want to install (and maintain) the RDM client on our DevOps Agents. server 2022.3.12.0 remotedesktopmanager module 2022.3.1.4 Thanks

514

23

avatar

Jonathan Lafontaine

avatar

marcelgerber

Backlog

PowerShell scripting documentation

Hello. The PS documentation is always confusing. For instance, with the DVLS Server connectivity, it is not clear what we can do afterwards. How to make sure the connection is active, how to manage sessions and credentials, etc. Some full examples could already help. The same for RDM PS. I'm always struggling to make it work. Everytime I create additional datasources and have to login with my username, even though I want to connect using automatic methods. I had a case open, which provided a solution, but that doesn't seem to work for me anymore. Ideally, PS would be using a server API, so we can manage everything. Best regards. Marcel

630

10

avatar

Erica Poirier

avatar

damiendaco

Script to automate entry creation in DVLS

Hi, I created a script to create entries, for our automation process. The goal is to be able to call the script with all required parameters, from our Gitlab CI runners. I tried to create a pull request on your github but I couldn't. So I'm pasting it here instead, feel free to add it to your collection. Best regards, Damien Daco <# . SYNOPSIS Adds a single machine entry to Devolutions Server. . DESCRIPTION This script connects to a Devolutions Server instance and adds a new machine entry (RDP, SSH, Web, or VNC) to a specified vault and folder. Credentials and connection details can be provided via parameters or environment variables. . PARAMETER ServerUrl The URL of the Devolutions Server instance. . PARAMETER VaultId The ID of the vault where the entry will be added. . PARAMETER Name The display name of the machine entry. . PARAMETER HostName The hostname or IP address of the machine. . PARAMETER ConnectionType The type of connection (RDP, SSH, Web, VNC). . PARAMETER Folder The folder name where the entry will be placed. . PARAMETER Description (Optional) Description for the entry. . PARAMETER Username (Optional) Username for the connection. . PARAMETER Password (Optional) Password for the connection. . PARAMETER Domain (Optional) Domain for the connection. . PARAMETER Group The group or parent folder for the entry. . EXAMPLE pwsh Add-Entries.ps1 -Name "tsttotoweb01" -HostName "127.0.0.1" -ConnectionType "RDP" -Folder "TOTO2" -Description "TST TOTO WEB 01" -UserName "DTA01" -Password "Password1234!" -Domain "MY_DOMAIN" -Group "TESTING" . NOTES Author: Damien Daco Version: 1.0 Date: July 10, 2025 #> [ CmdletBinding ()] param ( [ ValidateNotNullOrEmpty ()] [ string ] $ServerUrl = $DVLSUrl , [ ValidateNotNullOrEmpty ()] [ string ] $VaultId = "00000000-0000-0000-0000-000000000000" , [ ValidateNotNullOrEmpty ()] [ string ] $Name , [ ValidateNotNullOrEmpty ()] [ string ] $HostName , [ ValidateNotNullOrEmpty ()] [ string ] $ConnectionType , [ ValidateNotNullOrEmpty ()] [ string ] $Folder , [ string ] $Description , [ string ] $Username , [ string ] $Password , [ ValidateNotNullOrEmpty ()] [ string ] $Domain , [ ValidateNotNullOrEmpty ()] [ string ] $Group ) # Import the Devolutions Server module if not already imported try { if ( -not ( Get-Module - Name Devolutions.PowerShell - ErrorAction Stop)) { Write-Host "Importing Devolutions.PowerShell module..." - ForegroundColor Cyan Import-Module - Name Devolutions.PowerShell - Force - ErrorAction Stop } } catch { Write-Error "Failed to import Devolutions.PowerShell module: $_ " Write-Host "Troubleshooting steps:" - ForegroundColor Yellow Write-Host "1. Verify you have permission to install modules" - ForegroundColor Yellow Write-Host "2. Run 'Install-Module Devolutions.PowerShell -Scope CurrentUser -Force' manually" - ForegroundColor Yellow Write-Host "3. Check for any PowerShell execution policy restrictions" - ForegroundColor Yellow exit 1 } [ string ] $ApplicationID = $env:DS_USER [ string ] $ApplicationSecretKey = $env:DS_PASSWORD [ string ] $DVLSUrl = $env:DS_URL [ securestring ] $SecApplicationSecretKey = ConvertTo-SecureString $ApplicationSecretKey - AsPlainText - Force [ pscredential ] $Creds = New-Object System.Management.Automation.PSCredential ( $ApplicationID , $SecApplicationSecretKey ) # Add a new machine entry to Devolutions Server function Add-MachineEntry { param ( [ string ] $Name , [ string ] $HostName , [ string ] $ConnectionType , [ string ] $Folder , [ string ] $Description , [ string ] $Username , [ string ] $Password , [ string ] $Domain , [ int ] $Port , [ string ] $Group , [ string ] $VaultId ) try { # Check if entry already exists Write-Host "Checking if entry ' $Name ' already exists ..." - ForegroundColor Cyan $ExistingEntry = Get-DSEntry - VaultId $VaultId - FilterValue $Name - ErrorAction SilentlyContinue if ( $ExistingEntry ) { Write-Host "Entry ' $Name ' already exists. Skipping creation." - ForegroundColor Yellow exit 0 } else { Write-Host "Entry ' $Name ' does not exists. Creating..." - ForegroundColor Green # Create entry parameters based on connection type $EntryParams = @ { Name = $Name HostName = $HostName Description = $Description VaultId = $VaultId Group = $Group } if ( -not [ string ]::IsNullOrEmpty( $Username ) -and -not [ string ]::IsNullOrEmpty( $Password )) { $EntryParams .Add ( 'Username' , $Username ) $EntryParams .Add ( 'Password' , $Password ) } # Add port if specified if ( $Port -gt 0 ) { $EntryParams .Add ( 'Port' , $Port ) } # Create entry based on connection type switch ( $ConnectionType .ToLower ()) { "rdp" { New-DSRDPEntry @EntryParams } "ssh" { New-DSSSHShellEntry @EntryParams } "web" { New-DSWebEntry @EntryParams } "vnc" { New-DSVNCEntry @EntryParams } default { Write-Warning "Unsupported connection type: $ConnectionType . Using generic connection." New-DSConnection @EntryParams } } Write-Host "Added $ConnectionType entry for $Name " - ForegroundColor Green } } catch { Write-Error "Failed to add entry for $Name `: $_ " exit 1 } } # Main script execution try { # Connect to Devolutions Server $Response = New-DSSession - Credential $Creds - BaseURI $DVLSUrl - AsApplication Add-MachineEntry - Name $Name - HostName $HostName - ConnectionType $ConnectionType ` - Description $Description - Username $Username ` - Password $Password - Domain $Domain ` - Group " $Group \ $Folder " - VaultId $VaultId # -Port ([int]::TryParse($Machine.Port, [ref]$null) ) Write-Host "Script completed successfully!" - ForegroundColor Green } catch { Write-Error "An error occurred: $_ " exit 1 } finally { # Close the connection to Devolutions Server Close-DSSession Write-Host "Disconnected from Devolutions Server" - ForegroundColor Cyan }

199

2

avatar

Patrick Ouimet

avatar

KevGue

Implemented

Create X.509 certificate entry with PowerShell Module

Hello, we would like to automate various certificate processes and leverage the Devolutions PowerShell module for this. On the GUI RDM you can create an X.509 certificate entry, supplying a public-private key pair, which gets stored in the database. My question is can you create a functioning X.509 entry and also retrieve the information from it using the PowerShell module? I have checked the XML for an entry and I can't see any easy way to accomplish this. If not we will have to pick a different entry for this. Thank you in advance.

338

3

avatar

Maxime Bernier

avatar

MKrupa

Resolved

Unable to connect to RDMDataSource via Application Identity

Hi everyone, I am currently working on using PowerShell to automatically export all passwords stored in my vault to a .csv file. This is to be done via a scheduled task on my DVLS server. The server has the latest versions of DVLS Console, Server, RDM and Devolutions.PowerShell installed - so everything is up to date. My aim is to carry out authentication via an appkey and an appsecret, as no user interaction is planned. However, executing the following code opens a browser window for interactive login - which is not desired in my scenario. The application identity used has the required access rights both via DVLS groups and directly to the vault. If I log in via the open browser window, access works for a short time, but only as long as the Powershell session is active. The next time I run the script, the login window appears again. Code: Import-Module Devolutions.PowerShell $dsname = "dvls" $dsurl = "https://[DVLS-URL]" $appkey = "XXXXXX" $appsecret = "XXXXXXX" $ds = New-RDMDataSource -DVLS -Name $dsname -Server $dsurl -ScriptingTenantID $appkey -ScriptingApplicationPassword $appsecret -SetDatasource -WarningAction SilentlyContinue Set-RDMDataSource $ds #Location of the CSV file you want to export the RDM sessions to $exportFileName = "C:\Temp\EXPORTS\RDMCredentialsData_$(get-date -f yyyy-MM-dd).csv" Set-RDMCurrentRepository [Vault-ID] Update-RDMUI #Get all the sessions in the current vault $RDMsessions = Get-RDMSession | Where-Object {$_.ConnectionType -ne "Group"} | Select-Object -Property Name, ID, ConnectionType, Group, HostFull #Iterate in every session foreach ($session in $RDMsessions){ #Add the username field $session | Add-Member -MemberType NoteProperty "Username" -Value (Get-RDMSessionUserName -ID $session.id) #Add the password field as clear text to the session $session | Add-Member -MemberType NoteProperty "Password" -Value (get-RDMSessionPassword -ID $session.id -AsPlainText) #Export the session to a CSV file to the path configured earlier. $session | Export-Csv -Path $exportFileName -Append -NoTypeInformation } Thank you in advance for any help. Marco

270

10

avatar

Maxime Bernier

avatar

kiaarmani

Resolved

Attachments inside RDM export not being imported

Hello there, We are currently trying to migrate from a monolithic repository (which contains a folder for each client) to a structure that is one repository per client. For that I would like to export all folders as RDM files, create a new repository and then import the contents back into the new repository. Here is the code I am trying to use: try { # Create temp file for export $tempExportFile = "C:\Dev\_temp\RDM\" + $clientFolder.Name + ".rdm" # Export data Export-RDMSession -XML -Sessions $clientEntries -IncludeCredentials -IncludeAttachements -IncludeDocumentation -Path $tempExportFile -ErrorAction Stop -ForcePromptAnswer ([System.Windows.Forms.DialogResult]::Yes) Write-LogSimple -Message "Data exported to: $tempExportFile" -Type "INFO" # change repo Set-RDMCurrentRepository -Repository $targetRepo -ErrorAction Stop # import into new repo Import-RDMSession -Path $tempExportFile -ErrorAction Stop -ForcePromptAnswer ([System.Windows.Forms.DialogResult]::Yes) -DuplicateAction "Ignore" | Set-RDMSession Write-LogSimple -Message "success" -Type "ACTION" } catch { Write-LogSimple -Message "error '$($clientFolder.Name)': $($_.Exception.Message)" -Type "ERROR" # delete temp file if (Test-Path $tempExportFile) { Remove-Item -Path $tempExportFile -Force -ErrorAction SilentlyContinue } } For the Import-RDMSession command I tried using the -SetSession parameter too, with the same result. The entries (i.e. credentials) and folders are present in the new repository, while the attachments are not. Importing the exported .rdm file using the desktop application will import the attachments successfully. I tried placing the attachment into the root, on folder level and on a credential. None of them are imported. The export seemingly captures them indicated by the file size (38 MB), which also gets larger the more attachments I place. I tried this with Devolutions.PowerShell 2025.2.0, 2025.1.5 and 2025.1.4, with no success. Please advise. Sincerely, Kia Armani

284

3

avatar

Maxime Bernier

1 - 25 of 519 items