With AntAgent
MBean you can upload ant script and then invoke it on remote node:
from java.lang import String
import jarray
fileContent = '<project name="cleanup" default="cleanup"><target name="cleanup"><delete dir="${user.install.root}/temp" /><delete dir="${user.install.root}/wstemp" /></target></project>'
antAgent = AdminControl.makeObjectName(AdminControl.queryNames('WebSphere:*,type=AntAgent,process=dmgr'))
str = String(fileContent)
bytes = str.getBytes()
AdminControl.invoke_jmx(antAgent, 'putScript', [String('cleanup.xml'),bytes], jarray.array(['java.lang.String', '[B'], String))
AdminControl.invoke_jmx(antAgent, 'invokeAnt', [jarray.array([], String), String('cleanup.xml'), String('cleanup')], jarray.array(['[Ljava.lang.String;', 'java.lang.String', 'java.lang.String'], String))
fileContent
variable is you Ant script, you may have to tweak it a bit more, especially on Windows in order to deal with blocked files/directories.