Launching a process on remote machine using WMI with PowerShell
30 Dec 2017
I yesterday’s post - I have provided C++ code that could connect to a remote machine and launch a process. This time, I will repeat this using PowerSHell.
Here’s a PowerShell function I wrote that uses Invoke-WmiMethod cmdlet. You could also achieve the same using Invoke-CimInstance to create a Win32_Process instance and then call its create method.
To launch the payload, in the last post my approach was to map a network share, and then launch the payload from that share. This involves running the following commands in sequence:
net use \\<servername>\<sharename> /user:<username> <password>
\\<servername>\<sharename>\<payload.exe> <switches>
net use \\<servername>\<sharename> /delete
I can achieve the same in powershell by passing appropriate arguments to my Run-RemoteProcess powershell function.