Firstly, screen shots of code, really are not useful to us. It forces folks to have to retype what you did, which most are unwilling to do.
Because psexec is an interactive command tool. You can use it in the ISE, but you have to pass every param you need.
This is not a psexec limitation, try, say, nslookup and see the same issue.
You cannot use many interactive DOS/CMD command in the ISE console or IDE script pane as you do in cmd/console. That is not its design.
This has been documented since the ISE release.
Console Application (Non) Support in the ISE
There are some limitations on how the ISE interacts with console
applications you need to be aware of, for apps like ftp and netsh.
First of all, the ISE Runs console apps that don’t require user input
just fine. For example, “ping www.microsoft.com” and “cmd /c dir /s”
Piping also works fine in the ISE, For example, PS C:\Users\ibrar>
“show mode” | netsh netsh>online
Automation in scripts, that don’t require user interventions should be
fine.
However, if you run “cmd /k” which requires input, the ISE will be
stuck, and you’ll have to stop the pipeline, using Ctrl-Break or
pressing the stop button.
You can shell out to the console host as needed to do such things using the Start-Process cmdlet. or one of the other start methods.
See:
Running Executables in PowerShell | IT Pro
- The Call Operator & Technet
Why: Used to treat a string as a SINGLE command. Useful for dealing
with spaces.
In PowerShell V2.0, if you are running 7z.exe (7-Zip.exe) or another
command that starts with a number, you have to use the command
invocation operator &.
The PowerShell V3.0 parser do it now smarter, in this case you don’t
need the & anymore .
Details: Runs a command, script, or script block. The call operator,
also known as the "invocation operator," lets you run commands that
are stored in variables and represented by strings. Because the call
operator does not parse the command, it cannot interpret command
parameters
Example:
& 'C:\Program Files\Windows Media Player\wmplayer.exe' "c:\videos\my home video.avi" /fullscreen
So your psexec..
& 'C:\Tools\psexec.exe' "Your command arguments" /accepteula
Try adding the
/accepteula
switch to see if you aren’t seeing the Eula screen. But powershell has a lot of remote command execution capability, so I would certainly look there first before using psexec. – Appleoddity – 2019-03-25T04:46:13.990I have tried using /accepteula but it doesn't work. – Vinodh Gowda – 2019-03-25T04:50:15.177