IBM WebSphere wsadmin Tool Overview | Generated by AI

Home 2025.10

Overview of wsadmin in IBM WebSphere Application Server (WAS)

The wsadmin tool is a command-line scripting interface for administering WebSphere Application Server. It allows you to automate tasks like managing servers, deploying applications, configuring resources, and monitoring runtime operations. Scripts can be written in Jython (Python-based) or JACL (Tcl-based), with Jython being the more commonly used due to its readability.

Both tools are located in the bin directory of a WebSphere profile (e.g., <WAS_HOME>/profiles/<ProfileName>/bin/) or the base installation (<WAS_HOME>/bin/). It’s recommended to run them from the profile’s bin directory to ensure the correct environment.

Starting wsadmin Interactively

This launches a shell where you can enter commands directly.

Syntax:

wsadmin[.bat|.sh] [options]

Basic Example (Windows):

cd C:\IBM\WebSphere\AppServer\profiles\AppSrv01\bin
wsadmin.bat -lang jython -user admin -password mypass

Basic Example (Unix/Linux):

cd /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin
./wsadmin.sh -lang jython -user admin -password mypass

Once in the wsadmin prompt (e.g., wsadmin>), you can run commands using scripting objects:

Example Commands in the Shell:

Running a Script File

Use the -f option to execute a Jython (.py or .jy) or JACL (.jacl) script non-interactively.

Example Script (deployApp.py):

# Connect and deploy an app
appName = 'MyApp'
AdminApp.install('/path/to/MyApp.ear', '[-appname ' + appName + ']')
AdminConfig.save()
print 'Application ' + appName + ' deployed successfully.'

Run on Windows:

wsadmin.bat -lang jython -f /path/to/deployApp.py -user admin -password mypass

Run on Unix/Linux:

./wsadmin.sh -lang jython -f /path/to/deployApp.py -user admin -password mypass

Running a Single Command

Use the -c option for one-off commands (useful in batch files or automation).

Example (Windows batch file snippet):

@echo off
call "C:\IBM\WebSphere\AppServer\profiles\AppSrv01\bin\wsadmin.bat" -lang jython -c "print AdminConfig.list('Server')" -user admin -password mypass

Example (Unix shell script snippet):

#!/bin/bash
./wsadmin.sh -lang jython -c "print AdminConfig.list('Server')" -user admin -password mypass

Key Options

Option Description Example
-conntype Connector type: SOAP (default, port 8879) or RMI (port 2809). -conntype RMI
-host Remote host to connect to. -host myhost.example.com
-port Connector port. -port 8879
-tracefile Log output to a file. -tracefile wsadmin.log
-profile Run a profile script before the main script. -profile init.py
-c Execute a single command (non-interactive). -c "AdminConfig.save()"
-f Execute a script file. -f myscript.py
-job Run a job manager command. -job deploy.xml

Tips and Best Practices

For more advanced usage, explore the AdminTask object for simplified commands like AdminTask.importFile('path/to/file').

References


Back

x-ai/grok-4-fast

Donate