How to run commands via wsadmin from PowerShell?

396 Views Asked by At

I am creating a powershell script to do a ripple start for a cluster hosted on Windows websphere install.

For testing I was using this:

cmd.exe /k '"E:\u01\was85\bin\wsadmin.bat" -lang jython -c "print AdminApp.list()"'

This works fine and returns a list of installed apps.

From here I moved to trying to run wsadmin command to get my cluster name for the restart.

cmd.exe /k '"E:\u01\was85\bin\wsadmin.bat" -lang jython -c "print cluster = AdminControl.completeObjectName(''cell=ABCD0001Cell,type=Cluster,name=ZZZ,*'')"'

But I am getting an invalid syntax error, I assume I have not escaped my quotes correctly? Any ideas? Thanks in advance.

cmd.exe : Traceback (innermost last): At line:4 char:1

  • cmd.exe /k '"E:\u01\was85\bin\wsadmin.bat" -lang jython -c "print clu ...
  •   + CategoryInfo          : NotSpecified: (Traceback (innermost last)::String) [], RemoteException
      + FullyQualifiedErrorId : NativeCommandError
    
    (no code object) at line 0
    File "<input>", line 1
      print cluster = AdminControl.completeObjectName('cell=ABCD0001Cell,type=Cluster,name=ZZZ,*')   ^
    

SyntaxError: invalid syntax

0

There are 0 best solutions below