Jump to content

Recommended Posts

Posted

Hi guys!
Calling the below command from poweshell works flawlessly:

PsExec.exe \\remote-server-name -u User -p Pass tasklist /FI "ImageName eq notepad.exe" > C:\tmp\notepad_tasks.txt

When i try to call it form AutoIT script:

RunWait("PsExec.exe \\remote-server-name -accepteula -u User -p Pass tasklist /FI ""ImageName eq notepad.exe"" > C:\tmp\notepad_tasks.txt")

i keep getting this error:

Quote

ERROR: Invalid argument/option - '>'.
Type "TASKLIST /?" for usage.
tasklist exited on remote-server-name with error code 1.

 

The below action works without any problems:

RunWait("PsExec.exe \\remote-server-name -accepteula -u User -p Pass tasklist /FI ""ImageName eq notepad.exe"")

 

Any suggestions on how to escape the sign '>' ?

  • Developers
Posted

Try added the cmd prompt to allow for piping the STDOUT: 

RunWait(@comspec & " /c PsExec.exe \\remote-server-name -accepteula -u User -p Pass tasklist /FI ""ImageName eq notepad.exe"" > C:\tmp\notepad_tasks.txt")

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted
10 hours ago, Jos said:

Try added the cmd prompt to allow for piping the STDOUT: 

RunWait(@comspec & " /c PsExec.exe \\remote-server-name -accepteula -u User -p Pass tasklist /FI ""ImageName eq notepad.exe"" > C:\tmp\notepad_tasks.txt")

Jos

Yessss! This solution is working.

 

Thnak you very much foer your help!!!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...