Forum / Remote Desktop Manager - Macro/Script/Tools

Open-Rdm-Session problem...

Ok,

Long story short, I have a automated application running on a server that will from time to time need to open a RDP connection to a particular IP. It does this to ensure that in the case of a reboot or server crash, the account in question is re-logged in so that auto-start applications start up properly and are not left idle until the user next logs in.

I am using a windows application and calling a powershell script to do the work. RDM 8.0.12.0 is installed and registered on the box.

I can successfully create the session using the following code (please assume all variables are pre-populated with all relevant data). It should if I read this correctly, open a RDP session to the given session.. but its not. It does create the session properly and I can see it in RDM after running the script, its just not opening:


$name = [guid]::NewGuid()

$session = New-RDM-Session -Name "$name" -Host "$ip" -Kind "RDPConfigured"

$session.Username = $user
$session.HostPassword = $Pass

$session.OpenEmbedded = 1
Set-RDM-Session $session

$NewSessionID = $session.ID

Write-Host "Created Session with ID: $NewSessionID"

Open-RDM-Session -ID $NewSessionID


My idea here is to eventually do the following:

1. Create the temporary session with the given GUID
2. Open a RDP session to the temporary session
3. Wait a set period of time to give the log-in process time to do its thing.. .30 seconds?
4. Close and then delete the temporary session
5. exit the script.

Perhaps I am mis-understanding what Open-RDM-Session does? My imagination had it literally opening a session in the open copy of RDM running on the server... tho it appeared to do nothing at all?

Any kick in the right direction greatly appreciated!

Dave

Clock6 yrs

Oh, quick add: The session is created properly with all info intact - I can open it by double clicking on it in RDM - password and username and all that are valid and working.

Clock6 yrs

Another note I didn't notice before. Apparently its trying to do something as running this script brings the copy of RDM running to the front and sets focus to it. But no session is opened.

Clock6 yrs

Another note. After reading I tried this:

$var = Open-RDM-Session -ID "{$NewSessionID}" -Verbose

But again, no-go. No output at all from that. ($var is null and no output is written to console).

Clock6 yrs

Just had a quick read over your post, at first glance all looks good and should work with the exception of the closing of the session. I will have to debug and get back to you shortly.

In the mean time, this could be enough:
http://help.remotedesktopmanager.com/index.html?installation_commandlinearguments.htm
Using the /Template:{local template ID} /Host:{host name} /UserName:{username} /Password:{password} option you won't have to create and delete the session. You could simple define an RDP template (with all options you want) and use it to start the temporary session. The only thing missing in this case is, like with RDM PowerShell, is the close session functionality.

Stefane Lavergne

signaturesignature

Clock6 yrs

I actually left the close session out of the PS code above on purpose so I could look at and debug the session inside RDM (just to make sure it created properly, etc). The problem with command line is that I cannot close it after a set period of time, can I? I do not want to keep it open... the idea is a temporary connection just long enough to make sure that the startup stuff starts up, then disconnect the session (not log out). I expect that I will have to do about a dozen of these a hour or so... so I do not want them building up lol.

I guess I could use Process in C# to then kill the process after 30 seconds or so... but thats a very ugly way to do it and might crash something.

If you would like access to the server I am testing on, please let me know where to email RDP credentials... I have no problem giving you access if it helps better the product. Love RDM btw smile

Dave

Clock6 yrs

Dave,

How are you doing the PS close? Correct, command line doesn't support the closing of the session.

I agree, the C# kill process would be like killing an ant using TNT, it works but not pretty.

I'm not able to reproduce the issue here, having your server credentials will surely help. (private message or support @ devolutions.net)

Thanks

Stefane Lavergne

signaturesignature

Clock6 yrs

Just sent you a PM. Strange... I had hoped it was a global issue. :/

Dave

Clock6 yrs