Add multiple Tenants to machine via API script


Im sure this is really simple but I built some new machines that I want to add the Tenants to these based on an exisiting machine.

I can pull the tenantsids using from the current machine using the tenantids property:

$Tenantid = $Repository.machines.Findbyname(“xxxxxxxx”)

I thought this would work:

foreach ($machine in $machines) {

but I cant add seem to add in multiple tenants
Error i get is:

Exception calling “Modify” with “1” argument(s): "There was a problem with your request.

Hi Craig,

Thanks for getting in touch! In order to add multiple Tenants this way, you will need to pass through a single tenant at a time.

I had this working by doing something like the following:

foreach ($machine in $machines)
    $modify = $repository.Machines.Get($machine.Id)

Does this help you achieve what you are after here?

Looking forward to hearing from you.

Best regards,

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.