Search for Groups and change Security on results

Search for Groups and change Security on results

avatar

I am attempting to update security permissions on all groups that match a certain string.
Here is my oneliner.

Get-RDMSession | Where-Object {CONDITIONAL STATEMENT} | Set-RDMSessionProperty -Property 'SecurityGroup' -Value 'GUID'

I get all groups that match my where filter, but when I add the Set-RDMSessionProperty I receive an error message.


Set-RDMSessionProperty : The input object cannot be bound to any parameters for the command either because the command
does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline
input.

According to the help information on Set-RDMSessionProperty I should be able to pipe the Session through as a ByValue.

All Comments (3)

avatar

Hello,

Could you please try the following to see if this helps to resolve your issue?

Get-RDMSession | Where-Object {CONDITIONAL STATEMENT} | ForEach-Object {Set-RDMSessionProperty -ID $_.ID -Property 'SecurityGroup' -Value 'GUID'}
Best regards,

Érica Poirier

avatar

Hello,

Thank you for your reply, I was hoping not to need a ForEach loop, but if that's what I need to do so be it.

Now I am getting the following error:

Set-RDMSessionProperty : Object of type 'System.String' cannot be converted to type 'System.Guid'.

Piped Command
ForEach-Object { Set-RDMSessionProperty -ID $_.ID -Property 'SecurityGroup' -Value '97f0081d-430c-410c-98b4-27a74ccec348' }

avatar

Hello,

Here is another way to set the GUID for the Security Group.

[color=000000]ForEach-Object {[GUID]$guid = '97f0081d-430c-410c-98b4-27a74ccec348'; Set-RDMSessionProperty -ID $_.ID -Property 'SecurityGroup' -Value $guid}[/color]
Best regards,

Érica Poirier