code: @Override
      public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
          final ServiceName serviceName;
          if (context.getProcessType().isServer()) {
              serviceName = Services.JBOSS_AS;
          } else {
              //The HC/DC service name
              serviceName = ServiceName.JBOSS.append("host", "controller");
  
          }
  
          context.addStep(new OperationStepHandler() {
              @Override
              public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
                  ServiceController<?> service = context.getServiceRegistry(false).getRequiredService(serviceName);
                  ByteArrayOutputStream out = new ByteArrayOutputStream();
                  PrintStream print = new PrintStream(out);
                  service.getServiceContainer().dumpServices(print);
                  print.flush();
                  context.getResult().set(new String(out.toByteArray(), StandardCharsets.UTF_8));
              }
          }, OperationContext.Stage.RUNTIME);
      }
docs: {@inheritDoc}