Get name of RDP session in PowerShell

Resolved

Get name of RDP session in PowerShell

avatar

Hello,

I search to optimize a PowerShell script for creating an L2TP VPN. I want to know if it's possible to get the name of an RDP session in PowerShell.

Best regards,
Ferrara Evan

All Comments (4)

avatar

Hello,

The name of any entry type can be retrieved using the Name property of the PSConnection object like the following sample.

$Session = Get-RDMSession -ID 'd811fa89-e893-4643-a85d-5d76e13f92ad'
$SessionName = $session.Name


Let us know if that answers your question.

Best regards,

Érica Poirier

avatar

Hello,

In wait to your answer, I see that I can get the name of another method via PowerShell.

In the CMD Script Entry, I see that it's possible to get the name of RDP connexion. This work, through $NAME$. But when I have multiple word separated with a "-", it gets only the first word before the "-". Example : " ABC - Server Hyper-V", it gets only "ABC".


Do you have more information about this ?

Best regards,
Ferrara Evan

ac8e13ba-6e08-4174-94d4-d42f6eee23b3.png

avatar

Hello,

Sorry for the disturbance. I found a solution. I added a simple quote to the $NAME$ variable. It's working perfectly.

Thank you for your investment in my question.

Best regards,
Ferrara Evan

avatar

Hello,

Thank you for sharing your solution to the community.

Let us know if you have further questions about this.

Best regards,

Érica Poirier