Basics of wsadmin tool

The WebSphere administrative (wsadmin) scripting program is a powerful, non-graphical command interpreter environment enabling you to run administrative operations in a scripting language. The wsadmin tool is intended for production environments and unattended operations. The wsadmin tool provides:

  • Scripting capabilities
  • Command-line administration

The wsadmin tool uses the Bean Scripting Framework (BSF), which supports a variety of scripting languages to configure and control your WebSphere Application Server installation. The wsadmin tool provides support for:

  • Python commands through Jython
  • Tcl commands through Java Command Language Jacl

Jython versus Jacl:

  • Jython is syntax is more natural to Java or C programmers and Jacl is suited for admins familiar with Tcl
  • Future investment and strategic direction will be focused on the Jython language and it has much better support in RAD and WAS console
  • Jacl is supported in V7 and below versions but no future development or enhancements for Jacl
  • Jacl-to-Jython (Jacl2Jython) conversion assist tool is available

The wsadmin launcher makes administrative objects available through language-specific interfaces. Scripts use these objects for application management, configuration, operational control, and communication with MBeans running in WebSphere server processes. Three modes are used to invoke wsadmin:

  • Interactively; wsadmin

Example: <was_root>/profiles/profile1/bin/wsadmin/wsadmin

  • Command line; wsadmin -c <command>

Example: <was_root>/profiles/profile1/bin/wsadmin -c print(AdminApp.list()) -lang jython

  • Script file; wsadmin –f <script_file>

Example: <was_root>/profiles/profile1/bin/wsadmin -f D:/scripts/

You can use the wsadmin tool to perform the same tasks that you can perform using the administrative console. You can use the wsadmin tool to manage a WebSphere Application Server V7 installation. Examples of tasks include:

  • Start and stop deployment manager, nodes, application servers, enterprise applications, and clusters
  • Configure virtual hosts, JDBC providers, JMS resources
  • Create application servers
  • Create clusters and add members to a cluster

Administrative objects in wsadmin:

Five administrative objects perform different operations:

 1. AdminConfig object communicates with the Config Service in a WebSphere server to manipulate configuration data for a WebSphere installation. AdminConfig has commands to list, create, remove, display, and modify configuration data, as well as commands to display information about configuration data types.
Example: wsadmin> AdminConfig.list(“JDBCProvider”)

2. AdminControl object enables the manipulation of MBeans running in a WebSphere server process. The number and type of MBeans available to the scripting client depends on the server to which the client is connected.  If the client is connected to a Deployment Manager, then all the MBeans running in the Deployment Manager are visible, as are all the MBeans running in the Node Agents connected to this Deployment Manager, and all the MBeans running in the application servers on those nodes.
Example: wsadmin> AdminControl.getPort()

3. AdminApp object allows application objects to be manipulated, this includes installing, uninstalling, editing, and listing of enterprise applications.
Example: wsadmin> AdminApp.list()

4. AdminTask object enables the execution of available admin commands.
Example: wsadmin> AdminTask.listServers()
Benefits of using AdminTask:
– Provides more user friendly and task-oriented commands
– Runs simple and complex commands
– Commands grouped based on function
– Can be run in batch or interactive mode
– Can be run in connected or local mode

5. Help object provide general help information for the objects supplied by wsadmin for scripting: Adminconfig, AdminApp, AdminControl and Help. It also provide a means to obtain interface information about MBeans running in the system.
– print Help.AdminTask()
– print‘-commands’)
– print‘getPort’)

Important points to remember when using wsadmin:
When using wsadmin, remember the following important points:

  • Default language set during profile creation is Jacl that’s defined in <was_profile>/properties/, so you need to specify wsadmin -lang jython if you want to run individual jython commands
  • wsadmin commands are case-sensitive that’s why wsadmin -lang jython -c “admincontrol.getPort()” will not work
  • Running multiple commands in a script file is faster than running individual commands because a JVM process needs to be created every time when an individual command is run. That’s why wsadmin -f “script_file_name” is faster than individual commands with wsadmin -c
  • Saving configuration changes is a two-step process: The first step validates the changes and the the second step performs the save
  • Save periodically in the script file or interactive mode to persist configuration updates to existing objects



About Ishtiaque

I am IBM Certified Infrastructure Systems Architect, Linux Foundation Certified System Administrator, Oracle Certified Programmer in Java and Web Component Developer, and TOGAF 9 certified with over 10 years of support and development experience in IBM middleware software and Java. Additionally, have a sound grip in databases and OpenStack administration. I hold the following certifications: IBM Certified Infrastructure Systems Architect Linux Foundation Certified System Administrator (LFCS) TOGAF 9 Certified Oracle Certified Expert, Java EE6 Web Component Developer Oracle Certified Professional – Java 6 Programmer ITIL v3 Foundation Certified IBM Certified Solution Architect – Cloud Computing Infrastructure V1 IBM Certified System Administrator – WebSphere Portal V8, V7, V6.1, V6 IBM Certified System Administrator – WebSphere Application Server V7, V6.1 IBM Certified System Administrator – AIX V7 IBM Certified System Administrator – WebSphere MQ V7 IBM Certified Deployment Professional – Business Process Manager Advanced V7.5 IBM Certified Solution Advisor – Cloud Computing Architecture V3 IBM Certified Solution Developer – WebSphere Portal V5.1
This entry was posted in Scripts, WebSphere Application Server and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s