Powershell Set-RDMSession Bug?

avatar

Hi,

I just spent a lot of time researching why a Set-RDMSession didn't work on some groups but did on others.

I narrowed it down to just creating a single subfolder inside a top level folder: \toplevelfolderA\subfolder
The top level folders are NOT virtual folders and can be found in the database connections table. I even converted all virtual folders in that vault to real folders with the script found here: https://forum.devolutions.net/topics/28811/convert-virtual-folders-to-physical-folders (after some adjustments)

Trying the following commands:

New-RDMSession -Group "toplevelfolderA" -Name "subfolder" -Type Group -SetSession


$NewGroup = New-RDMSession -Group "toplevelfolderA" -Name "subfolder" -Type Group
Set-RDMSession $NewGroup


All throw the error: Set-RDMSession : Connection has invalid group specified.

Now's the tricky part: the exact same commands do work for toplevelfolderB

Using module version 2022.1.0.6 from Powershell Gallery (also tried with an older version)

This is what I have in my database:

Select Data from connections where (name = 'toplevelfolderB' or name = 'toplevelfolderA') and RepositoryID = '6FB83240-50AD-4571-B4ED-3A9105E0305A'


<?xml version="1.0"?>
<Connection>
	<ConnectionType>Group</ConnectionType>
	<CreatedBy>DOMAIN\Administrator</CreatedBy>
	<CreationDateTime>2019-07-03T14:02:50</CreationDateTime>
	<Group>toplevelfolderB</Group>
	<ID>55c66a15-56ad-4058-b01b-070b1caaceb2</ID>
	<Name>toplevelfolderB</Name>
	<Stamp>ecb9dd8d-8497-40d7-9f42-69f06e56217f</Stamp>
</Connection>

<?xml version="1.0"?>
<Connection>
	<ConnectionType>Group</ConnectionType>
	<CreatedBy>DOMAIN\Administrator</CreatedBy>
	<CreationDateTime>2019-07-03T14:00:36</CreationDateTime>
	<Group>toplevelfolderB</Group>
	<ID>9f1b2f24-1bd7-4dc3-b148-ec8ef564b0af</ID>
	<Name>toplevelfolderB</Name>
	<Stamp>326cf5bc-c700-41b0-bd01-afb9d3c11d25</Stamp>
</Connection>

<?xml version="1.0"?>
<Connection>
	<ConnectionType>Group</ConnectionType>
	<CreatedBy>DOMAIN\Administrator</CreatedBy>
	<CreationDateTime>2019-07-03T14:02:49</CreationDateTime>
	<Group>toplevelFolderA</Group>
	<ID>74939ad1-2992-4d23-93d4-8bc6bfe9150c</ID>
	<Name>toplevelFolderA</Name>
	<Stamp>f0d9d09f-bd68-4214-b73b-0af95d3ec111</Stamp>
</Connection>

<?xml version="1.0"?>
<Connection>
	<ConnectionType>Group</ConnectionType>
	<CreatedBy>DOMAIN\Administrator</CreatedBy>
	<CreationDateTime>2019-09-02T07:46:36</CreationDateTime>
	<Group>toplevelFolderA</Group>
	<ID>328a55b8-4915-4833-9525-93b17f1edf9c</ID>
	<Name>toplevelFolderA</Name>
	<Stamp>d1fc7607-3f18-46ff-977c-810c5da98d38</Stamp>
</Connection>


As it turns out: I could not create the subfolder because the casing on 'toplevelfolderA' was wrong in my command. I needed 'toplevelFolderA'. I am moving expired entries from one vault to another and in between runs, I changed the case in the main vault which caused this cr*p.

All Comments (2)

avatar

Hello Thomas,

As you noticed, the name of the group (folder) is case sensitive. One way to prevent this error would be to do a Get-RDMSession first to make sure it exists. You could use the following:

$toplevelfolderA = Get-RDMSession -name "toplevelFolderA"

$subfolder = New-RDMSession -Group $toplevelfolderA.name -Name "subfolder" -Type Group -SetSession


Best regards,

Richard Boisvert

avatar

Hi Richard,

Well I implemented that in my code after finding out it's case sensitive. I've been maintaining the RDM implementation for my company for 10 years now (150+ users) and never noticed that you can add two entries next to each other with different case: toplevelfolderA and toplevelFolderA.

I got to the solution at the end of typing out everything in this forum post and was a bit frustrated so I refused to just delete it. Apologies for the clutter.

Best regards,
Thomas