So this is kind of based on this thread: Trying to get a PowerCLI script to run on multiple vCenters at once
I now need to take the script and modify it so specific users can be added to a specific folder on multiple vCenters. The vCenters are setup the same under 1 particular datacenter, same folders, sub folder structure, etc. Whereas the previous script would add the permission to the particular folder that existed on only one of the vCenters I need this to add a user to both. I've tried playing around with the array and specifying other options, like New-VIPermission -Entity myfolder -Server $viservers -Principal $usertoadd -Role VirtualMachineUser -Propagate:$true but I just get this:
New-VIPermission : 8/30/2019 10:11:25 AM New-VIPermission The specified parameter 'Entity' expects a single value, but your name criteria 'myfolder' corresponds to multiple values.
I'm sure it's something very simple, but I'm not sure of what the right fix is exactly for this. I thought I could create another array in the param section from the previous script and have something like: [array]$folder = (Get-Folder -Name myfolder)
But that didn't work. Any help appreciated.
Thanks.