How to get WildFly Server list using the CLI

In this short article, we will learn how to fetch the list of Servers in JBoss EAP or WildFly Domain using the Command Line Interface. This will let you automate your tasks by looping over your Server List.

Getting the Server List from the CLI

Firstly, connect to JBoss EAP or WildFly CLI:

./ -c

Then, execute the following command:

    "outcome" => "success",
    "result" => [

Replace the name of the Host with the actual Host name. Another option, which is especially useful if you want to execute this command as part of the script, is the following:

[domain@localhost:9990 host=primary] cd /host=primary
[domain@localhost:9990 host=primary] ls server
server-one    server-three  server-two  

As you can see, by navigating on the target host, you can execute the ls command to fetch the server list, with no JSON characters in it. Therefore, it is simple to extract this information as part of a script. This article shows how to use this information to loop through all servers in a Domain to start/stop them: How to Start, Stop and Restart WildFly


This article was a walk through the CLI commands you can use to get the server list of a JBoss / WildFly Domain. It is worth mentioning that you can also fetch the server list easily from the Web Console. Select the Runtime Tab and then, from the left menu, choose Topology:

jboss get the server list