JakubPL Posted December 4, 2020 Posted December 4, 2020 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 Jos Posted December 4, 2020 Developers Posted December 4, 2020 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 JakubPL 1 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.
JakubPL Posted December 5, 2020 Author Posted December 5, 2020 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!!!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now