FreeKB - How to use the WebSphere wsadmin utility
How to use the WebSphere wsadmin utility

Home > Search > How-to

The wsadmin utility can be used to perform a wide variety of administrative tasks. Use the following command to start the wsdamin utility.

~]# /opt/IBM/WebSphere/your_server_name/profiles/your_profile_name/bin/


Username / Password

If you are using federated or LDAP repositories, you will be prompted to provide a username and password. Enter the username and password of an administrative user.



Or, the username and password can be provided on the command line.

~]# /opt/IBM/WebSphere/your_server_name/profiles/your_profile_name/bin/ -user root -password your_password


The prior options are not ideal, as the username and password provided are visible using the ps command.

~]# ps -ef | grep java
. . . -user root -password your_password


The username and password can be entered in the was_home/profiles/profiles/properties/soap.client.props file for SOAP connections.


Or, the username and password can be entered in the was_home/profiles/profiles/properties/sas.client.props file for RMI or JSR160RMI connections.


Or, the username and password can be entered in the was_home/profiles/profiles/properties/ipc.client.props file for IPC connections. You will also comment out the login source line.



Language (Jacl, Jython)

The wsadmin utility uses to different languages, Jacl or Jython. You can specify the language you want to use.

~]# /opt/IBM/WebSphere/your_server_name/bin/ -lang jacl
~]# /opt/IBM/WebSphere/your_server_name/bin/ -lang jython


If you don't specify a language, either Jacl or Jython will be used. By default, Jython is the default language, which is specified in the file.



Once connected to the wsdamin console, there will be a wsadmin> prompt, where you can enter a command. Following is an example of the same command issued in Jython and Jacl.

# Jython

# Jacl
wsdamin>$AdminTask searchUsers


Scripting Objects - ( AdminConfig, AdminControl, AdminApp, AdminTask )

Wsadmin commands have a structure of Scripting Object - Command - Attributes. For example, in the following samples, AdminConfig is the scripting object, attributes is the command, and ApplicationServer is the attribute.

# Jython
wsadmin> print AdminConfig.attributes('ApplicationServer')

# Jacl
wsadmin> $AdminConfig attributes ApplicationServer


There are 4 scripting objects that can be used.

  • AdminConfig
  • AdminControl
  • AdminApp
  • AdminTask

The AdminConfig, AdminApp, and AdminTask scripting objects are used to interact with a configuration object, and the AdminControl is used to interact with a runtime object. For example, if you want to check the status of an application server, such as running or stopped, you would use AdminControl, since an application server status is runtime. Since AdminControl is used against runtime, the AdminControl has no impact on persistant configuration.

One of the most frequently used AdminConfig commands is save. This saves a change to the master repository.

# Jacl
$AdminConfig save

# Jython


Generate commands from the WebSphere admin console

One of the most useful features of the WebSphere admin console is the consoles ability to create wsadmin commands for you. For example, lets say you want to determine the wsadmin command to restart one of your JVMs. To do this, you would sign into the WebSphere admin console, and then restart the JVM. Then, on the right side of the admin console, select "View administrative scripting command for last action." A pop-up box will be displayed with the wsadmin command.


Run commands in-line

By default, the wsadmin command will start a user interface where you can type in a command. The -c option can be used to instruct the wsadmin command to run a command instead of being prompted to enter a command. In this example, the AdminApp.view command is executed in a single command.

~]# -c "print AdminApp.view('myApp')"


Run Python script

The -f option is used to run another script, such as a Python script.

~]# -f


Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter in the box below so that we can be sure you are a human.