Hi all!
Here's my issue/requirement.
Please help!
Thanks!
Hello,
To update a field at run time, you must use the $RDM.Save().
I designed this little bit of code :
$p1 = $RDM.connection.MetaInformation.CustomField1Value
$p2 = $RDM.connection.MetaInformation.CustomField2Value
$RDM.connection.host = (Resolve-DnsName -name $p1 -server $p2).IPAddress
$RDM.save()
Ultimately, this will use another DNS than my own to resolve an address and change the host. It works great, but even then, the effect is temporary, because the "events" Section will work on a "copy" of the actual entry, and will not save the changes on the data source directly.
I hope this helps nevertheless...
Best regards,
Alex Belisle
Hello Alexandre!
Thanks for the quick reply. What kind of an object is "$RDM"? Is that a pre-defined variable? Sorry, I'm new to this.
Hello,
$RDM will refer to the application itself, at runtime.
This object is available when using macro/script/tools, Events scripts, and Batch Edits from the UI.
https://help.remotedesktopmanager.com/powershell_batchactionssamples.html?q=batch
When running Windows Powershell, or from RDM -> Tools -> Powershell, this $RDM is not available (and would not be useful anyway.)
Glad I could help!
Best Regards,
Alex Belisle
Hi Alex,
Is there a way to call a power shell script first and then call $RDM.Save() in the before connect event?
Thanks!
Hello,
From the Powershell Macro/script/tools , I assume it's possible. This however got me wondering what are you trying to achieve?
Thanks for the details.
Best regards,
Alex Belisle
All I’m trying to do is to update the host name during before connect event using a value calculated in PowerShell and save that value in RDM so that it uses the new host to connect rather than the previous value. Right now, it doesn’t update the host name during the before connect event. It uses the previous value during the connect event. But when you double click again on the session after that, you see the new value is being used. But I want it to be captured in the same event. Hope this makes sense.
Hello,
Thanks for the update.
Before trying to update RDM Data source itself, could you get my bit of code working?
$RDM.connection.host = "NewHost"
$RDM.save()
This would have the connection to use the new value, and as I explained, it will not update the data source, but will calculate and connect to this new value.
If this works, then we can work on saving it in the data source for future utilization.
That said, after the new host is applied, would not it be a good idea to disable the "Before Connect" event?
Thanks for your cooperation.
Best regards,
Alex Belisle
Hello,
how to find out what properties the $RDM object has? Currently I'm searching for an equivalent of variable $PARENT_HOST$
KR, Roland
Sorry to bother you - already found a way:
$RDM | Export-Clixml C:\temp\rdm_dump.xml
Hello,
Thanks a lot for providing this info!
Best regards,
Alex Belisle