Start-Process on Remote Computer

Jun 20, 2007 at 6:17 PM
I am searching for a way to start a process on another computer, specifically a server. Is there a way to do it, I see that start-process does not contain a parameter for computer.
Jun 20, 2007 at 7:51 PM
Start-Process is a cmdlet wrapper around the .NET Process.Start method. It doesn't support this functionality. You might want to check out PSExec which is part of the Sysinternals suite and not actually a PowerShell cmdlet.
Jun 20, 2007 at 9:38 PM
Edited Jun 20, 2007 at 9:39 PM
Thanks for the reply.
I am actually trying to follow something I found while searching:!46FC6E00B8BE200F!117

My goal is to deploy a windows service remotely through an automated nany script.
Jun 20, 2007 at 10:27 PM
Well I found the answer.
This is my ps1 file:

function global:new-process()
param (string$computer, string$commandline=$(throw "Command line required."))

# Win32_Process. Create-Method Template Script"
# Created by PowerShell WmiExplorer
# /\/\o\/\/ 2006
# Fill InParams values before Executing
# InParams that are Remarked (#) are Optional

$Class = "Win32_Process"
$Method = "Create"
$LaunchArgs = $commandline,$null,$null,0

$MC = WmiClass"\\$Computer\ROOT\CIMV2:$Class"

"Calling Win32_Process."
$R = $mc.PSBase.InvokeMethod($Method, $LaunchArgs)
"Result :"
$R | Format-list

Call that with a computer name and command to execute and your good to go.
Jun 21, 2007 at 4:02 AM
Yep. WMI is a good way to go if you want to perform the operation on a remote computer.
Jun 21, 2007 at 7:20 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.