Valid TaskActions are:

CheckRunning (Required: ProcessName Output: IsRunning)

Create (Required: Parameters Output: ReturnValue, ProcessId)

Get (Required: ProcessName, Value Optional: User, ProcessName, IncludeUserInfo Output: Processes)

Terminate (Required: ProcessName or ProcessId)

Remote Execution Support: Yes

Namespace: MSBuild.ExtensionPack.Computer
Assembly: MSBuild.ExtensionPack (in MSBuild.ExtensionPack.dll) Version: 3.5.0.0

Examples

Xml Copy imageCopy
<Project ToolsVersion="3.5" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <TPath>$(MSBuildProjectDirectory)\..\MSBuild.ExtensionPack.tasks</TPath>
        <TPath Condition="Exists('$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks')">$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks</TPath>
    </PropertyGroup>
    <Import Project="$(TPath)"/>
    <ItemGroup>
        <WmiExec3 Include="CommandLine#~#notepad.exe"/>
    </ItemGroup>
    <Target Name="Default">
        <MSBuild.ExtensionPack.Computer.Process TaskAction="Terminate" ProcessId="9564"/>
        <MSBuild.ExtensionPack.Computer.Process TaskAction="Create" Parameters="@(WmiExec3)">
            <Output TaskParameter="ReturnValue" PropertyName="Rval2"/>
            <Output TaskParameter="ProcessId" PropertyName="PID"/>
        </MSBuild.ExtensionPack.Computer.Process>
        <Message Text="ReturnValue: $(Rval2). ProcessId: $(PID)"/>
        <MSBuild.ExtensionPack.Computer.Process TaskAction="CheckRunning" ProcessName="notepad.exe">
            <Output PropertyName="Running" TaskParameter="IsRunning"/>
        </MSBuild.ExtensionPack.Computer.Process>
        <Message Text="notepad.exe IsRunning: $(Running)"/>
        <MSBuild.ExtensionPack.Computer.Process TaskAction="Terminate" ProcessName="notepad.exe"/>
        <MSBuild.ExtensionPack.Computer.Process TaskAction="CheckRunning" ProcessName="notepad.exe">
            <Output PropertyName="Running" TaskParameter="IsRunning"/>
        </MSBuild.ExtensionPack.Computer.Process>
        <Message Text="notepad.exe IsRunning: $(Running)"/>
        <MSBuild.ExtensionPack.Computer.Process TaskAction="Get" IncludeUserInfo="true">
            <Output ItemName="ProcessList" TaskParameter="Processes"/>
        </MSBuild.ExtensionPack.Computer.Process>
        <Message Text="%(ProcessList.Identity)  - %(ProcessList.User) - %(ProcessList.OwnerSID)"/>
    </Target>
</Project>

Inheritance Hierarchy

System..::..Object
  Microsoft.Build.Utilities..::..Task
    MSBuild.ExtensionPack..::..BaseTask
      MSBuild.ExtensionPack.Computer..::..Process

See Also