Hello,
I'm trying to launch a RDP session with a script ps1 placed in "Event" => "Before Open".
When I click to "Open Session", I will wait for 1 min before that the session launch.
This my configuration for my event (see attachment)
Best regards,
Ferrara Evan
Hello,
What RDM version are you using?
What data source type are you connected to?
Have you installed the RDM PowerShell module on your machine?
Do you get any error when you try to open PowerShell (RDM CmdLet) in Tools menu?
Best regards,
Érica Poirier
Hello,
I'm using the 2022.3.30.0 64-bit version.
The data source it's an RDP session.
Yes, I installed this module.
I have this line when I launch PowerShell (RDM CmdLet) (see attachment)
Best regards,
Ferrara Evan
Hello,
Thank you for your feedback.
About the data source, it's the container that holds the entries.
https://help.remotedesktopmanager.com/datasources.html
Is it possible to share the PowerShell script you use in the Before Open event?
What entry type are you trying to open that will launch the script?
Best regards,
Érica Poirier
Hello,
It's a Microsoft Azure SQL
You can see the script in the attachment :
It's an RDP (Microsoft Remote Desktop)
Best regards,
Ferrara Evan
Hello,
Thank you for the information.
I see that the script is verifying that if a VPN connection is already existing on your machine, it will start it. Otherwise it will create the VPN and start it.
Is running this script outside RDM takes as much time as running it in the Before Open event?
If it's faster, could you please save this script in a file and call it from the Before Open event using Import-Module "yourscriptfilename"?
Best regards,
Érica Poirier
Hello,
Yes, it does.
The script can be running outside RDM, but it takes less time (about 10 seconds).
I forgot to tell you that a use an PowerShell (Local) entry. I put my script in this entry. In my RDP entry in the Before Event, I choose "Macro/Script/Tool" and the location of the PowerShell entry.
I hope that help you.
Best regards,
Ferrara Evan
Hello,
Thank you for your feedback.
Do you get the same behaviour when running the script from a .ps1 file like the following?
Best regards,
Érica Poirier
Hello,
If my previous solution didn't help, you can try the following method.
As RDM will wait for the PowerShell process to start when using any PowerShell entry type, try to use a Command line Macro/Script/Tool that will open PowerShell and run your script.
Ensure that the Open embedded/tabbed is disabledd for the Command Line entry.
And set it in the Before Open event of your RDP entry.
Let me know if that solution is faster.
Best regards,
Érica Poirier
Hello,
Thank you for your answer.
The second solution works perfectly.
I have another question. It's possible to get credentials from a "Password Entry" via script ?
Best regards,
Ferrara Evan
Hello,
Thank you for your feedback and glad that the latter solution worked!
Yes it's possible to get credentials from a Password entry using the Get-RDMSessionUsername and Get-RDMSessionPassword cmdlets.
Let us know if you have further questions about it.
Best regards,
Érica Poirier
Hello,
Thank you for your answer.
For the moment, I don't have questions about this.
Best regards,
Ferrara Evan