Help Page Home

# POST SessionMachines({id})/Drain

Drain and delete a session machine.

The session machine will first drain all user sessions, then will automatically be deleted. If the session machine was part of a delivery group, another session machine will be immediately allocated to the delivery group to maintain the desired capacity.

## Request Information

### Parameters

Name | Description | Additional information
--- | --- | ---
id | ID of the session machine to drain and delete. | Type: String
changeId | See Optimistic Concurrency. | Type: String

## Response Information

True

### Response type

SessionMachineModel

### Response body formats

#### application/json, text/json

Sample:

    {
      "Href": "[api:SessionMachines(77b50020-4252-453c-815b-ce9b9412d543)]",
      "Id": "77b50020-4252-453c-815b-ce9b9412d543",
      "ChangeId": "12",
      "Name": "machine1",
      "DeleteState": "NotDeleted",
      "State": "Allocated",
      "IsShared": false,
      "VersionUpdatePending": false,
      "SessionMachineCatalogVersion": 2,
      "SessionMachineCatalog": {
        "Href": "[api:SessionMachineCatalogs(628fa898-0c36-4024-8fe4-d7e9a9bfbcfa)]",
        "Name": "catalog 1",
        "Id": "628fa898-0c36-4024-8fe4-d7e9a9bfbcfa"
      },
      "MachineDetail": {
        "Href": "[api:MachineDetails(bff69e21-c280-488b-ad9e-74b674ffb7c9)]",
        "Name": "machine1",
        "Id": "bff69e21-c280-488b-ad9e-74b674ffb7c9"
      },
      "DeliveryGroup": {
        "Href": "[api:DeliveryGroups(c004375e-a96d-4368-96ba-c80702d7e80f)]",
        "Name": "dg1",
        "Id": "c004375e-a96d-4368-96ba-c80702d7e80f"
      },
      "DeliverySite": {
        "Href": "[api:DeliverySites(0ef3e68d-bb8e-4b69-9c30-ae3fac533996)]",
        "Name": "site1",
        "Id": "0ef3e68d-bb8e-4b69-9c30-ae3fac533996"
      },
      "Tenant": {
        "Href": "[api:Tenants(91ade655-feb5-47d3-9585-a5827ad50132)]",
        "Name": "Tenant 1",
        "Id": "91ade655-feb5-47d3-9585-a5827ad50132"
      },
      "Tags": [
        "tag"
      ],
      "CustomProperties": [
        {
          "Name": "myProperty",
          "Value": "myValue"
        }
      ],
      "HealthSummary": {
        "ActiveCount": 0,
        "ErrorCount": 0,
        "WarningCount": 0,
        "InfoCount": 1,
        "Messages": [
          {
            "Text": "Attempting to reach desired capacity",
            "IsError": false,
            "IsWarning": false,
            "IsInfo": false,
            "IsActive": true,
            "Type": "Allocation"
          }
        ]
      },
      "Domain": {
        "Href": "[api:Domains(241b45cc-261d-47d0-81d7-a0a41c54c760)]",
        "Name": "domain1.local",
        "Id": "241b45cc-261d-47d0-81d7-a0a41c54c760"
      },
      "Network": "network1",
      "DataCenter": {
        "Href": "[api:DataCenters(af1fc9c4-dee5-4b0d-836c-9e1c5b57a88a)]",
        "Name": "datacenter1",
        "Id": "af1fc9c4-dee5-4b0d-836c-9e1c5b57a88a"
      },
      "UserName": "DOMAIN\\user1",
      "UserTenant": {
        "Href": "[api:Tenants(91ade655-feb5-47d3-9585-a5827ad50132)]",
        "Name": "Tenant 1",
        "Id": "91ade655-feb5-47d3-9585-a5827ad50132"
      }
    }