Valid TaskActions are:

AddUser (Required: User Optional: Domain, FullName, Description, Password, PasswordExpired, PasswordNeverExpires)

AddGroup (Required: Group Optional: Domain, Description, GroupType)

AddGroupToGroup (Required: Parent, Group). Windows Server 2008 only.

AddUserToGroup (Required: User, Group)

CheckUserExists (Required: User Output: Exists)

CheckUserPassword (Required: User, Password Optional: BindingContextOptions, ContextTypeStore, Domain Output: Exists)

CheckGroupExists (Required: Group Output: Exists)

DeleteUser (Required: User)

DeleteGroup (Required: Group)

DeleteUserFromGroup (Required: User, Group)

GetGroupMembers (Required: Group Optional: GetFullMemberName Output: Members)

GetUserPassword (Required: User Optional: BindingContextOptions, ContextTypeStore, Domain, ErrorOnCancelOutput: Password)

GrantPrivilege (Required: User, Privilege Optional: Domain)

RemoveGroupFromGroup (Required: Parent, Group). Windows Server 2008 only.

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)"/>
    <Target Name="Default">
        <!-- Check a user Exists -->
        <MSBuild.ExtensionPack.Computer.ActiveDirectory TaskAction="CheckUserExists" User="JudgeJS1">
            <Output TaskParameter="Exists" PropertyName="DoesExist"/>
        </MSBuild.ExtensionPack.Computer.ActiveDirectory>
        <Message Text="JudgeJS1 Exists: $(DoesExist)"/>
        <!-- Add local Users -->
        <MSBuild.ExtensionPack.Computer.ActiveDirectory TaskAction="AddUser" User="JudgeJS1" Description="Elgnt" Password="123546fdfdRERF$" PasswordNeverExpires="true"/>
        <MSBuild.ExtensionPack.Computer.ActiveDirectory TaskAction="AddUser" User="JudgeJS2" Description="Elgnt" PasswordNeverExpires="true"/>
        <!-- Grant a user a privilege local Users -->
        <MSBuild.ExtensionPack.Computer.ActiveDirectory TaskAction="GrantPrivilege" User="JudgeJS1" Privilege="SeServiceLogonRight"/>
        <!-- Check a user Exists -->
        <MSBuild.ExtensionPack.Computer.ActiveDirectory TaskAction="CheckUserExists" User="JudgeJS1">
            <Output TaskParameter="Exists" PropertyName="DoesExist"/>
        </MSBuild.ExtensionPack.Computer.ActiveDirectory>
        <Message Text="JudgeJS1 Exists: $(DoesExist)"/>
        <!-- Check a Group Exists -->
        <MSBuild.ExtensionPack.Computer.ActiveDirectory TaskAction="CheckGroupExists" Group="NewGroup1">
            <Output TaskParameter="Exists" PropertyName="DoesExist"/>
        </MSBuild.ExtensionPack.Computer.ActiveDirectory>
        <Message Text="NewGroup1 Exists: $(DoesExist)"/>
        <!-- Add local Groups -->
        <MSBuild.ExtensionPack.Computer.ActiveDirectory TaskAction="AddGroup" Group="NewGroup1" Description="Elgnt"/>
        <MSBuild.ExtensionPack.Computer.ActiveDirectory TaskAction="AddGroup" Group="NewGroup2" Description="Elgnt"/>
        <!-- Check a Group Exists -->
        <MSBuild.ExtensionPack.Computer.ActiveDirectory TaskAction="CheckGroupExists" Group="NewGroup1">
            <Output TaskParameter="Exists" PropertyName="DoesExist"/>
        </MSBuild.ExtensionPack.Computer.ActiveDirectory>
        <Message Text="NewGroup1 Exists: $(DoesExist)"/>
        <!-- Add the users to the Groups -->
        <MSBuild.ExtensionPack.Computer.ActiveDirectory TaskAction="AddUserToGroup" User="JudgeJS1;JudgeJS2" Group="NewGroup1;NewGroup2"/>
        <!-- To add domain user(s) to a group, prefix name with the user's domain -->
        <MSBuild.ExtensionPack.Computer.ActiveDirectory TaskAction="AddUserToGroup" User="ADOMAIN\JudgeJS1" Group="Group1"/>
        <!-- Delete Users from Groups -->
        <MSBuild.ExtensionPack.Computer.ActiveDirectory TaskAction="DeleteUserFromGroup" User="JudgeJS1" Group="NewGroup1;NewGroup2"/>
        <!-- Delete local Users -->
        <MSBuild.ExtensionPack.Computer.ActiveDirectory TaskAction="DeleteUser" User="JudgeJS1;JudgeJS2"/>
        <!-- Delete local Groups -->
        <MSBuild.ExtensionPack.Computer.ActiveDirectory TaskAction="DeleteGroup" Group="NewGroup1;NewGroup2"/>
        <!-- Add a remote User -->
        <MSBuild.ExtensionPack.Computer.ActiveDirectory TaskAction="AddUser" User="JudgeJS1" MachineName="D420-7" Description="Elgnt" Password="123546fdfdRERF$" PasswordNeverExpires="true"/>
        <!-- Add a remote Group -->
        <MSBuild.ExtensionPack.Computer.ActiveDirectory TaskAction="AddGroup" Group="RemoteGroup1" MachineName="D420-7" Description="na"/>
        <!-- Add a Domain User -->
        <MSBuild.ExtensionPack.Computer.ActiveDirectory TaskAction="AddUser" User="JudgeJS1" Domain="mydomain" Description="Elgnt" Password="123546fdfdRERF$" PasswordNeverExpires="true"/>
        <!-- Add a Domain Group -->
        <MSBuild.ExtensionPack.Computer.ActiveDirectory TaskAction="AddGroup" Group="DomainGroup1" Domain="mydomain" Description="na"/>
        <!-- Get a user's password-->
        <MSBuild.ExtensionPack.Computer.ActiveDirectory TaskAction="GetUserPassword" User="Michael" ContextTypeStore="Machine">
            <Output TaskParameter="Password" PropertyName="Pass"/>
        </MSBuild.ExtensionPack.Computer.ActiveDirectory>
        <Message Text="User Password: $(Pass)"/>
        <!-- Check a user's password-->
        <MSBuild.ExtensionPack.Computer.ActiveDirectory TaskAction="CheckUserPassword" User="Michael" ContextTypeStore="Machine" Password="$(Pass)">
            <Output TaskParameter="Exists" PropertyName="DoesExist"/>
        </MSBuild.ExtensionPack.Computer.ActiveDirectory>
        <Message Text="User Exists: $(DoesExist)"/>
        <!-- Get Group Members -->
        <MSBuild.ExtensionPack.Computer.ActiveDirectory TaskAction="GetGroupMembers" Group="Performance Monitor Users;Users">
            <Output TaskParameter="Members" ItemName="Groups"/>
        </MSBuild.ExtensionPack.Computer.ActiveDirectory>
        <Message Text="%(Groups.Identity)"/>
        <!-- Get Group Members including Parent -->
        <MSBuild.ExtensionPack.Computer.ActiveDirectory TaskAction="GetGroupMembers" GetFullMemberName="true" Group="Performance Monitor Users;Users">
            <Output TaskParameter="Members" ItemName="FullGroups"/>
        </MSBuild.ExtensionPack.Computer.ActiveDirectory>
        <Message Text="FULL %(FullGroups.Identity)"/>
        <!-- Group Group Operations -->
        <MSBuild.ExtensionPack.Computer.ActiveDirectory TaskAction="AddGroup" Group="NewGroup1" Description="Elgnt" GroupType="Global"/>
        <MSBuild.ExtensionPack.Computer.ActiveDirectory TaskAction="AddGroup" Group="NewGroup2" Description="Elgnt" GroupType="Global"/>
        <MSBuild.ExtensionPack.Computer.ActiveDirectory TaskAction="AddGroupToGroup" ParentGroup="NewGroup1" Group="NewGroup2"/>
        <MSBuild.ExtensionPack.Computer.ActiveDirectory TaskAction="RemoveGroupFromGroup" ParentGroup="NewGroup1" Group="NewGroup2"/>
        <MSBuild.ExtensionPack.Computer.ActiveDirectory TaskAction="AddGroupToGroup" ParentGroup="NewGroup1" Group="NewGroup2"/>
        <MSBuild.ExtensionPack.Computer.ActiveDirectory TaskAction="AddGroupToGroup" ParentGroup="NewGroup1" Group="NewGroup2"/>
    </Target>
</Project>

Inheritance Hierarchy

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

See Also