New-RDMSession -Group $xxx -Kind "TemplateGroup" is not created under $xxx, PowerShell

New-RDMSession -Group $xxx -Kind "TemplateGroup" is not created under $xxx, PowerShell

avatar

I have a powershell script that uses a shared template to create a Company group

$companyname = Read-Host 'Enter the company name'

New-RDMSession -Name $companyname -Kind "TemplateGroup" -TemplateID $templates[$answer-1].ID | Set-RDMSession

(the template ID is set by a prompt from a list of group templates)

$sitename = Read-Host 'Enter the site name'

New-RDMSession -Group $companyname -Name $sitename -Kind "TemplateGroup" -TemplateID $templates[$answer-1].ID | Set-RDMSession

(again the template ID is set by a prompt from a list of group templates)

The template is created in the root of the navigation tree.

It does not process the -Group variable

If I add from template manually in the navigation pane, the template is added under the selected group.

All Comments (6)

avatar

Hello,

What version of RDM are you using?

What do you mean with 'It does not process the -Group variable? Is it when creating the Site Group Folder, it is not created under the Company Group Folder?

Best regards,

Érica Poirier

avatar

Version 11.7.2.0

Yes it is not created under the Company Group Folder, it is created in root.

avatar

Hello,

I am still unable to reproduce your issue. Have you tried to update the UI with the Update-RDMUI cmdlet just after the creation of the Company Group folder?

Could you please send me your PowerShell script in a private message?

Best regards,

Érica Poirier

avatar

Hello,

I have found a solution. Could you please try to set the -Kind parameter to "Group" instead of "TemplateGroup" for the creation of the site folder?

$sitename = Read-Host 'Enter the site name'

New-RDMSession -Group $companyname -Name $sitename -Kind "Group" -TemplateID $templates[$answer-1].ID | Set-RDMSession

Best regards,

Érica Poirier

avatar

Hi Erica

I have emailed you my script.

Changing the kind to Group does add the folder as a subfolder of the group folder however the template items are not created inside it, just a red circle with a white i.

avatar

Hello,

I can reproduce this issue. A ticket has been sent to our engineering department.

As a workaround, could you please change your script to modify the group of each entry in the template?

$sitename = Read-Host 'Enter the site name'

$sess = New-RDMSession -Name $sitename -Kind "TemplateGroup" -TemplateID $template[$answer-1].ID

foreach ($entry in $sess) {

$entry.Group = $companyname + "\" + $entry.Group

}

Set-RDMSession $sess

Best regards,

Érica Poirier