powershell - add windows explorer session

powershell - add windows explorer session

avatar

Hi,

i am trying to create a new windows file explorer session by powershell

$sessionexplorer = New-RDMSession -Type "Addon" -name "c$"
$sessionexplorer.ConnectionSubType = "2b657353-30dc-411a-891d-8874e457f35f"
$sessionexplorer.OpenEmbedded = $False
Set-RDMSession $sessionexplorer


This work's ok, but i can not add the folder and host attributes. These are stored in the addon xml, but that is not initialized when creating a new entry.

When i edit the newly created entry in gui and add a folder and a host, i can read the xml in powershell and edit the values.

$session = Get-RDMSession -name 'c$'
[xml]$xmlProperties = $session.AddOn.Properties
$xmlProperties.InnerXml

$xmlProperties.WindowsExplorerConfiguration.Folder = "folder"
$xmlProperties.WindowsExplorerConfiguration.Host = "host"

$session.AddOn.Properties = $xmlProperties.InnerXml
Set-RDMSession $session


How to initialize the "WindowsExplorerConfiguration" for a new entry in powershell ?


There are a lot of "RemoteDesktopManager.AddOn" objects, but i can't find one for windows file explorer...

All Comments (6)

avatar

Hello,

What RDM version are you using?

And what data source type are you using?

Best regards,

Érica Poirier

avatar

Hello,

RDM is version 2020.1.20.0 64-Bit

Datasource for testing right now is a SQLite DB.


avatar

Hello,

Thank you for the information.

Could you please try the following? That should be easier than trying to create or edit XML code!

$newSession = New-RDMSession -Type 'AddOn' -Name 'c$'
$newSession.ConnectionType = 'FileExplorer'
$newSession.FileExplorer.Host = 'host'
$newSession.FileExplorer.Folder = 'folder'
Set-RDMSession -Session $newSession
Update-RDMUI


Best regards,

Érica Poirier

avatar

Hello,

Because of the version you are using, this will not be possible to use the code I have provided.

The provided sample script is working from RDM beta 2020.2.4 or higher as we have modified how the File Explorer entry type is handled in RDM.

Sorry about that!

Best regards,

Érica Poirier

avatar

Hi, so this will work with one of the next releases ?

OK, i will wait and give it a try then. For now i found a workaround by exporting the addon xml to a file and append that to the newly created entries...

Thank you.

avatar

Hello,

Indeed and it is already available in RDM Beta 2020.2.6 you can download here.
https://remotedesktopmanager.com/home/download#Beta

Your workaround is really interesting. Thank you for this hint.

Best regards,

Érica Poirier

Closed