Forum / Remote Desktop Manager - PowerShell Repository

To support RDM Powershell script running as a service, Open-RDMSession should provide return values

  • Create an Issue
  • Cancel

I have a script that forces RDM synchronization with a CSV using the Synchronizer object.

It runs silently using this command: Open-RDMSession -ID $SyncTempGuid -Silent

I am not sure whether RDM is sucesfully executed every time.

Could Open-RDMSession by updated to provide a return value to check for a successful execution ?

-Stu

Clock3 yrs

Hello,

Are you running your PowerShell script in RDM or is it an external script?

Our engineering team will have a look on your request to see it is possible.

Best regards,



Érica Poirier

signaturesignature

Clock3 yrs

I have a script that is run with a service account and an ELEVATED PowerShell session from Task Scheduler. The script body imports the RDM module.


I have logged on to the server as the service account and configured RDM - so it has a profile.


Thanks, Stu

Clock3 yrs

Hi,


When you say you want a return value to check for a successful execution. By successful execution, do you mean when you open the connection and tried to start the sync or once the sync is done without errors?


Best regards,

Olivier Désalliers

signaturesignature

Clock3 yrs

I know that Open-RDMSession can be used for many type of actions. I my case I am opening a Synchronizer object by guid to execute it.
I'd like to know the result of the execution of the named synchronizer.


By successful execution, do you mean when you open the connection and tried to start the sync or once the sync is done without errors?


I'd like to know as much as possible.
Did the Synchronizer run without errors? (Best case)
Did I successfully start the synchronizer? (worst case)
-Stu

Clock3 yrs

Hi,

I think the solution would be to have an Open-RDMSyncSession cmdlet that returns a SyncResultObject with two properties in it. One to know if the sync was successfully executed or not and another one to have the PSConnection imported.

Best regards,

Olivier Désalliers

signaturesignature

Clock3 yrs

That would be great.

Clock3 yrs

Hi Stuart,

We will add this to our TODO List.

Best regards,

Olivier Désalliers

signaturesignature

Clock3 yrs

Hi,

The cmdlet Open-RDMSyncSession will be available in the next RDM version. It returns an object called PSSyncResult which contains a property named Connections that contains the connections that have been imported, log that contains a string of the actions done and Success which is a bool that determines if the sync has been executed successfully.

Ex:

$result = Open-RDMSyncSession -Session $syncSession

or

$result = Open-RDMSyncSession -ID $syncSession.ID

Best regards,

Olivier Désalliers

signaturesignature

Clock3 yrs

This is great!
Thank you very much. Stu

Clock3 yrs

I just upgraded to the latest RDM 12.5.2.0 and my powershell script does not update. Looks like the synchronizer does not work. Is this updated command documented?

In fact I think my first RDM command "Get-Datasource" is no longer working? Do we need a flag to tell it now to use integrated authentication?
Thanks, Stu

Clock3 yrs

Hi,

Do you mean you can't use Open-RDMSyncSession or when you use it the sync session doesn't start?

The cmdlet Open-RDMSyncSession is in our PowerShell module, the cmdlet is not available in the deprecated snap-in.

You can import it in your script using the Import-Module command.

For example if you installed RDM at the default location you can do it that way:

Import-Module "C:\Program Files (x86)\Devolutions\Remote Desktop Manager\RemoteDesktopManager.PowerShellModule.psd1"

Best regards,

Olivier Désalliers

signaturesignature

Clock3 yrs

Tomorrow I need to do some debugging.
This morning my server side scripts that run under Task Scheduler to sync RDM data sources failed after working for months. I think a user updated their RDM client and updated the sql data source schema without me knowing So I updated my server side client driven by powershell and am trying to get it to update via open open-rdmsyncsession.

I currently use Import-Module "C:\Program Files (x86)\Devolutions\Remote Desktop Manager\RemoteDesktopManager.PowerShellModule.psd1"
BTW/ the RemoteDesktopManager.PowerShellModule.psd1 file is still dated 10-13-2016?

My script has been calling it for months that way by importing the module. In this thread you indcated that in the next major build open-rdmsyncsession would now return results?
Have any PowerShell commands changed required properties with this new build?
Also, my script called RDM powershell commands using the inherited authenticated user. Does this need to change.
Right now not even my first $RDM_DS = Get-RDMDataSource command works.

Clock3 yrs

The Powershell module loads correctly from within RDM tools menu. Get-RDMDatasource spews component names from after the import-module. As I mentioned it's dated 2016.

Clock3 yrs

Olivier,
I worked through my issues. I didn't catch that the command change from open-RDMSession to Open-RDMSyncSession.

Can you provide details on the PSSyncResult object? $result.Success is now returing true. But $result.Connections and $result.log are null

BTW/ what IDE do you use for writing and debugging your Powershell work? PowerGui is dead and the MS Powershell IDE has clumsy debugging.
Thanks, Stu

Clock3 yrs

Hi,

Both Open-RDMSession and Open-RDMSyncSession exist.

Open-RDMSession is to open all session types.

Open-RDMSyncSession is to start a sync session and get the result back.

PSSyncResult contains three attributes:

Success (bool): True if the sync has been successfully executed
Connections (PSConnection[]): Contains connections affected by the sync. If it's null it means that the sync didn't touch any connections.
Log(string): Contains the sync log. It's basically the message you see in the window after the sync is done in RDM. If it's null it means that the message in the window would have been empty.

About the RemoteDesktopManager.PowerShellModule.psd1 file date. RemoteDesktopManager.PowerShellModule.psd1 is the module manifest that describes the contents of a module and determines how a module is processed. It points to RemoteDesktopManager.PowerShellModule.dll which is the binary PowerShell module.

The module is developed with Visual Studio and I usually use Windows PowerShell ISE to create PowerShell scripts.

Best regards,

Olivier Désalliers

signaturesignature

Clock3 yrs

Since customers are writing solutions using Powershell, Devolutions will need to start commutating when you make BREAKING changes to commandlets during upgrades.


Get-RDMDatasource return objects now have a .Name property instead of the prior .DisplayName
Open-RDMSession -id xxx - -silent stopped working. I changed to Open-RDMSyncSession, droped the silent property and it worked.


Thanks, Stu

Clock3 yrs

Hi,


The cmdlets and objects in the module are not backward compatible with the ones in the snap-in but a lot is similar between the two.

If we make breaking changes in the module they will be communicated.

Best regards,

Olivier Désalliers

signaturesignature

Clock3 yrs