PSExec Command to execute multiple cmd

@RealStruggler 21 Reputation points
2021-03-15T11:36:41.197+00:00

Hello Guys,

I am having a bit of challenge executing two cmds using psexec.

Here's my command

77785-host.png

But the same doesn't work with psexec

77780-ps.png

I have also tried the command below:

PSExec \Machinename cmd /c (hostname ^& bcdedit | find "path")

doesn't work.

Any suggestions please =)

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,460 questions
0 comments No comments
{count} votes

Accepted answer
  1. Ian Xue (Shanghai Wicresoft Co., Ltd.) 34,271 Reputation points Microsoft Vendor
    2021-03-15T12:05:42.733+00:00

    Hi @@RealStruggler ,

    Try replacing parentheses with quotation marks

    PsExec \\Machinename cmd /c 'hostname && bcdedit |find "path"'  
    

    Best Regards,
    Ian Xue

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful