hasRemoteCapabilities() === true) { $agent_policies = $agent->getConfPolicies(); $oldIds = []; $newIds = []; foreach ($agent_policies as $oldId => $name) { $oldIds[] = $oldId; $newIds[] = $policies[io_safe_input($name)]; } $res_update_con_policy = $agent->updatePolicyIds( $oldIds, $newIds ); if ($res_update_con_policy === false) { echo 'Failed ['.$agent->name()."]\n"; } else { echo 'Agent '.io_safe_output($agent->alias())." updated successfully\n"; } } else { echo 'Agent '.io_safe_output($agent->alias())." skipped\n"; } } catch (Exception $e) { echo $e->getMessage()."\n"; } }