--- title: "Set-AssignTask" slug: "scripting-set-assigntask" updated: 2025-07-16T15:22:59Z published: 2025-07-16T15:22:59Z canonical: "help.agilityblue.com/scripting-set-assigntask" --- > ## Documentation Index > Fetch the complete documentation index at: https://help.agilityblue.com/llms.txt > Use this file to discover all available pages before exploring further. # Set-AssignTask ## Summary Assign a task to someone or remove assignment. Assigning a task will place the task status into `In Progress` if the task was previously in the `New` state whereas removing an existing assignment will place the task status into `New`. ```powershell Set-AssignTask    -TaskId    -UserId ``` Returns a [task](https://apidocs.agilityblue.com/#7188f9cc-69d1-4f96-818f-bb8b2d08e739) object. ## Parameters | Parameter | Type | Required? | Notes | | --- | --- | --- | --- | | TaskId | Int32 | Yes | The task id. | | UserId | String | No | The user id to assign the task to. If not provided or `null`, the task will be unassigned. | ## Examples ### Assign a task to someone ```powershell $assignedTask = Set-AssignTask `    -TaskId 1123 `    -UserId "510e109b-6ff5-4442-9670-cd5e3cd82a7a" # Output some information to help indicate that the task was successfully assigned Write-Output "Task $($assignedTask.TaskId) ($($assignedTask.Name)) has been assigned to $($assignedTask.AssignedToFullName)" # For debug purposes, convert the data to output as JSON so we can see all the fields Write-Output "" Write-Output "JSON Results:" $jsonOutput = $assignedTask | ConvertTo-Json -Depth 10 # Output the data Write-Output $jsonOutput ``` Execution results: ```json Task 1123 (Monthly KPI Review) has been assigned to Max Miller JSON Results: {  "Metadata": null,  "AssignedBy": null,  "AssignedTo": null,  "Client": null,  "CompletedBy": null,  "CreatedBy": null,  "Forms": [],  "Matter": null,  "Project": null,  "QualityCheckPerformedBy": null,  "Subscribers": [],  "TaskId": 1123,  "ProjectId": 2025040000001,  "ProjectTypeId": 1,  "ProjectTypeName": "Normal",  "ProjectTypeDescription": "The normal project type where task work is performed.",  "ProjectSourceTypeId": 2,  "ProjectSourceTypeName": "Agility Blue",  "ProjectDescription": "Automated Reports",  "ProjectComputedTags": null,  "ProjectRequesterId": null,  "ProjectRequesterFirstName": null,  "ProjectRequesterLastName": null,  "ProjectRequesterFullName": null,  "ProjectRequesterEmail": null,  "MatterId": 107,  "MatterName": "Automated Reports",  "MatterReference": null,  "ClientId": 94,  "ClientName": "Automation",  "ClientReference": null,  "Name": "Monthly KPI Review",  "AssignedToId": "510e109b-6ff5-4442-9670-cd5e3cd82a7a",  "AssignedToFullName": "Max Miller",  "AssignedById": "510e109b-6ff5-4442-9670-cd5e3cd82a7a",  "AssignedByFullName": "Max Miller",  "EstimatedHours": null,  "ActualHours": null,  "StatusId": 2,  "StatusDescription": "In Progress",  "QualityCheckStatusId": 1,  "QualityCheckStatusDescription": "Not Performed",  "QualityCheckPerformedById": null,  "QualityCheckPerformedByFullName": null,  "FormNames": "General Instructions",  "SortOrder": 0,  "DateDue": "2025-07-17T12:36:12.9484378+00:00",  "CompletedOn": null,  "CompletedById": null,  "CompletedByFullName": null,  "AssignedOn": "2025-07-16T13:20:33.1489808+00:00",  "NumberOfComments": 0,  "NumberOfAttachments": 0,  "NumberOfMediaLogEntries": 0,  "NumberOfVolumes": 0,  "NumberOfBillingEntries": 0,  "NumberOfSubscribers": 0,  "NumberOfEmailMessages": 0,  "CreatedByFullName": "Max Miller",  "CreatedById": "510e109b-6ff5-4442-9670-cd5e3cd82a7a",  "CreatedOn": "2025-07-15T20:22:07.0068888+00:00",  "LastUpdatedByFullName": "Max Miller",  "LastUpdatedById": "510e109b-6ff5-4442-9670-cd5e3cd82a7a",  "LastUpdatedOn": "2025-07-16T13:20:33.1489808+00:00",  "LastUpdatedBy": null } ```