Forum / Remote Desktop Manager - Support

RDM automated Powershell export from Devolutions Password Vault datasource

  • Create an Issue
  • Cancel


Hello everyone,

I'm trying to get this automated export running, so we have all sessions up to date on our emergency workstation.

The script is running in Powershell on our Password Vault server an looks like this:

===========================================================

$RDMModule = "D:\Program Files (x86)\Devolutions\Remote Desktop Manager\RemoteDesktopManager.PowerShellModule.psd1"
$ExportFile = "\\anotfall\d$\Apasswd Export\Apasswd_Export.xml"

Import-Module $RDMModule

$sessions = Get-RDMSession

$exportPwd = "notfall"
$pass = ConvertTo-SecureString $exportPwd -asplaintext -force;

Write-Host "Export Sessions..."


Export-RDMSession -Path $ExportFile -Sessions $sessions -XML -Password $pass -IncludeCredentials



===========================================================

When I start this script myself it is running perfectly fine and the export is working.

Then I tried to automate it in a scheduled task with the following settings:

===========================================================

Run whether the user is logged on or not: checked
Run with highest privileges: checked

Action: Start a program
Program: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
arguemnts: -command "&{C:\Scripts\DataSourceExport\RDM_Export.ps1}" -ExecutionPolicy Bypass -noprofile

Start in: C:\Scripts\DataSourceExport

===========================================================


So whenever I try to run this scheduled task it gets stuck on running until I force it to stop.
I tried some logging and I figured out that it is getting stuck on the "Get-RDMSession" part.

Can you tell me, where I went wrong here or is there any better way to get this daily export?

Clock14 days

Hello,

exists for the user that execute the scheduled task a valid RDM login?

Regards,
Min

Clock12 days


Hello Min,

thank you for replying!

I'm sorry I forgot to mention, the user is part of the Admin Group, so he has full access on the data source.
Also this is the same user I used to run the test manually, which is working fine.

Have you ever made this work as a scheduled task?

Clock12 days

Hello,

Could you specify what authentication method you are using?

I'm asking before we have seen some setups using Integrated Security not working as expected, as it's not reliable to try to pass an Authentication Token instead of a set of credentials.

Also, it is recommended to use the portable version of the Application to implement such functionality.
(https://help.remotedesktopmanager.com/installation_portableusb.htm)

This way, you make sure that there is only one data source available at execution time (I suspect you might be connected to the wrong data source at run time).

Another way that you might want to explore, is to set you Powershell Script within a Powershell Session type in RDM, create a shortcut (from session's property window -> Advanced), and call it from the scheduler.

Let me know if it helps.


Best regards,




Alex Belisle
OFFICE CLOSURE!
Although our various support queues will be monitored for emergencies, Devolutions' offices will be closed on September 2nd 2019.

signaturesignature

Clock11 days


Hi Alex,

thank you for the input!

The portable version didn't change anything, but when I tried to run the script as a remote desktop session, I noticed the script is getting stopped here:

==================================================

Transcript started, output file is C:\scripts\DataSourceExport\log\13082019_112146.log
Import Module...
Get Sessions...
Do you want to connect in offline mode?
[Y] Yes [N] No (default 'N'):
==================================================

When I start it myself on the server it is going on, without any user input. But here it seems to wait for input.
It is even running as "non interactive".

Is there any way to suppress this and force online mode?

Clock11 days

Hello,

Going offline would not (I think) be a viable solution. first, it will require to login physically and periodically to ensure the cache is always up to date, and not deleted after the expiration...

That said, this should be working.
Here's something you can try :
- From portable version, make sure that you implement the override.cfg file (as described in the help topic I sent yesterday.
- When you import the module, instead of using the one in program files, use the newly created application path. Before it works, you will also have to unblock the files from this folder, with : dir * | unblock-file -verbose. I like using verbose so I can see them unblocking.
- Run the app, make sure it's not using your own profile config file (you should be prompted to enter licence and configure a new data source), configure with the DVLS custom user.

If you'd like, you can open a ticket (ticket@devolutions.net) so we can plan something to help you, or at least define if there's an issue...

Thanks for letting us know.


Best regards,



Alex Belisle
OFFICE CLOSURE!
Although our various support queues will be monitored for emergencies, Devolutions' offices will be closed on September 2nd 2019.

signaturesignature

Clock11 days


Hi Alex,

the RDM Portable was already set up and used correctly.

As I suspected the only problem was the prompt asking for offline mode. I just had to figure out how to disable that (data souce settings) and now it's working perfectly.

Thank you for your assistance!


Clock11 days

Hello,

Good news! Thank you so much for the feedback, have a great one.

Best regards,



Alex Belisle
OFFICE CLOSURE!
Although our various support queues will be monitored for emergencies, Devolutions' offices will be closed on September 2nd 2019.

signaturesignature

Clock10 days