Network Deployment (Distributed operating systems), v8.0 > Scripting the application serving environment (wsadmin) > Use the wsadmin scripting AdminTask object for scripted administration
Invoke an administrative command in batch mode using wsadmin scripting
Use AdminTask commands to invoke an administrative command in batch mode.
This topic describes how to invoke an administrative command in batch mode using wsadmin.sh.
To invoke an administrative command in interactive mode, see the topic on invoking a command in interactive mode.
Procedure
- Invoke the AdminTask object commands interactively, in a script, or use the wsadmin -c command from an operating system command prompt.
See the topic on starting the wsadmin scripting client.
- Issue one of the following commands:
- If an administrative command does not have a target object and an argument, use the following command:
### Jacl
$AdminTask commandName### Jython
AdminTask.commandName()
- If an administrative command includes a target object but does not include any arguments or steps, use the following command:
### Jacl
$AdminTask commandName targetObject### Jython
AdminTask.commandName(targetObject)
- If an administrative command includes an argument or a step but does not include a target object, use the following command:
### Jacl
$AdminTask commandName options### Jython
AdminTask.commandName(options)
- If an administrative command includes a target object, and arguments or steps:
### Jacl
$AdminTask commandName targetObject options### Jython
AdminTask.commandName(targetObject, options)
Example
- The following example invokes an administrative command with no target object, argument, or step:
### Jacl
$AdminTask listNodes### Jython
print AdminTask.listNodes()Example output:
myNode
- The following example invokes an administrative command with a target object string:
### Jacl
set s1 [$AdminConfig getid /Server:server1/] $AdminTask showServerInfo $s1### Jython
s1 = AdminConfig.getid('/Server:server1/') print AdminTask.showServerInfo(s1)Example output:
{cell myCell} {serverType APPLICATION_SERVER} {com.ibm.websphere.baseProductVersion 6.0.0.0} {node myNode} {server server1}
- The following example invokes an administrative command with an option string:
### Jacl
$AdminTask getNodeMajorVersion {-nodeName myNode}### Jython
print AdminTask.getNodeMajorVersion('[-nodeName myNode]')Example output:
6
- The following example invokes an administrative command with a target object and non-step option strings:
### Jacl
set ra [$AdminConfig getid /J2CResourceAdapter:myResourceAdapter/] $AdminTask createJ2CConnectionFactory $ra {-name myJ2CCF -jndiName j2c/cf -connectionFactoryInterface javax.resource.cci.ConnectionFactory}### Jython
ra = AdminConfig.getid('/J2CResourceAdapter:myResourceAdapter/') AdminTask.createJ2CConnectionFactory(ra, '[-name myJ2CCF -jndiName j2c/cf -connectionFactoryInterface javax.resource.cci.ConnectionFactory]')Example output:
myJ2CCF(cells/myCell/nodes/myNode|resources.xml#J2CConnectionFactory_1069690568269)
- The following example invokes an administrative command with a target object and a step option:
### Jacl
set serverCluster [$AdminConfig getid /ServerCluster:myCluster/] $AdminTask createClusterMember $serverCluster {-memberConfig {{myNode myClusterMember "" "" false false}}}### Jython
serverCluster = AdminConfig.getid('/ServerCluster:myCluster/') AdminTask.createClusterMember(serverCluster, '[-memberConfig [[myNode myClusterMember "" "" false false]]]')Example output:
myClusterMember(cells/myCell/nodes/myNode|cluster.xml#ClusterMember_3673839301876)
Invoke an administrative command in interactive mode using wsadmin.sh
Start the wsadmin scripting client using wsadmin.sh