I am trying to chain commands in PowerShell as we do with CMD exe. For example, if I want to chain multiple command-line commands together in a wob I use the "&" character. These wob echos to the spool file, retrieves a dir listing for the home dir, changes loc to C temp and get a dir listing for C temp. This works fine.
NT_JOB TEST01
AGENT SCWKLDT1
ENVAR HOME="C:\PROGRAM FILES\WORKLOAD_AUTOMATION"\WORKLOAD_AGENT"
CMDNAME C:\WINDOWS\SYSTEM32\CMD.EXE
ARGS /C ECHO "STARTING CHAIN" & DIR & PUSHD C:\TEMP & DIR
RUN ANY
ENDJOB
Trying to do the same thing with PowerShell.
I can run each cmd individually, but I am not able to chain them together. I have tried, "&", "|", ";" and several other variations found online. Any help chaining PowerShell commands together in an ESP wob would be appreciated.
Example
NT_JOB A079011A.TEST01
AGENT SCWKLDT1
ENVAR HOME="C:\PROGRAM FILES\WORKLOAD_AUTOMATION"\WORKLOAD_AGENT"
CMDNAME POWERSHELL.EXE
ARGS Write-Host "Starting_Chain" ; Get-ChildItem ; push-Location C:\temp ; Get-Child-Item
RUN ANY
ENDJOB
Thank you!
------------------------------
Eric Kammerer
IT Systems Engineer | Workload Engineering
Progressive Insurance
------------------------------