Reset computer
Resets a computer account.
POST ~/api/directoryObjects/account/reset
Request parameters
This request has no parameters.
Request headers
-
Name
-
Required
-
Description
-
Adm-Authorization
-
True
-
Specify the security token obtained during authentication.
-
Content-Type
-
True
-
Use application/json as the value of this header.
Request body
The request body is a JSON object with the following data structure:
{
"directoryObject": "<objectId>"
}
directoryObject string
The identifier of the computer to reset. A computer can be identified by:
Distinguished name (DN) {.black}
# Example
CN=MYCOMPUTER,OU=Computers,DC=example,DC=com
Globally unique identifier (GUID) {.black}
# Example
78562b97-5ad5-40b3-96a4-f8d48dd00247
Security identifier (SID) {.black}
# Example
S-1-5-21-3635505734-1729062939-1827655016-1582
Responses
If successful, returns 200 OK
status code and an operation result in the response body. Otherwise, returns one of the common HTTP error codes and an error description in the response body.
Examples
Reset a computer
The following code sample resets a computer account.
Request
- PowerShell
-
$computerIdentifier = "CN=MYCOMPUTER,OU=Computers,DC=example,DC=com" $baseUrl = "https://host.example.com/restApi" $endpoint = "/api/directoryObjects/account/reset" $requestUrl = $baseUrl + $endpoint $requestHeaders = @{"Adm-Authorization" = "HxtdAPz73OFfae7....w7lQvxjJHIbVqgkCtPtLD"} $requestBody = ConvertTo-Json @{ "directoryObject" = $computerIdentifier; } # Make request Invoke-RestMethod -Method POST -Headers $requestHeaders -Uri $requestUrl ` -Body $requestBody -ContentType "application/json"
- C#
-
using System; using System.Text; using System.Net.Http; using System.Threading.Tasks; class Program { static async Task Main() { const string baseUrl = "https://host.example.com/restApi"; const string endpoint = "/api/directoryObjects/account/reset"; const string token = "HxtdAPz73OFfae7....w7lQvxjJHIbVqgkCtPtLD"; // Create JSON request body string jsonRequest = @" { 'directoryObject': 'CN=MYCOMPUTER,OU=Computers,DC=example,DC=com' }"; StringContent requestBody = new StringContent( jsonRequest, Encoding.UTF8, "application/json"); // Initialize HTTP client using (HttpClient client = new HttpClient()) { client.DefaultRequestHeaders.Add("Adm-Authorization", token); // Make request HttpResponseMessage response = await client.PostAsync( baseUrl + endpoint, requestBody); string responseBody = response.Content.ReadAsStringAsync().Result; Console.WriteLine(responseBody); } } }
- cURL
-
curl --header 'Adm-Authorization: HxtdAPz73OFfae7....w7lQvxjJHIbVqgkCtPtLD' \ --header 'Content-Type: application/json' \ --request POST 'https://host.example.com/restApi/api/directoryObjects/account/reset' \ --data-raw '{ "directoryObject": "CN=MYCOMPUTER,OU=Computers,DC=example,DC=com" }'
- node.js
-
var https = require('https'); // Request parameters and headers var options = { 'method': 'POST', 'hostname': 'host.example.com', 'path': '/restapi/api/directoryObjects/account/reset', 'headers': { 'Adm-Authorization': 'HxtdAPz73OFfae7....w7lQvxjJHIbVqgkCtPtLD', 'Content-Type': 'application/json' } }; // Create JSON request body var postData = ` { "directoryObject": "CN=MYCOMPUTER,OU=Computers,DC=example,DC=com" }`; // Make request var req = https.request(options, function (res) { var chunks = []; res.on("data", function (chunk) { chunks.push(chunk); }); res.on("end", function (chunk) { var body = Buffer.concat(chunks); console.log(body.toString()); }); res.on("error", function (error) { console.error(error); }); }); req.write(postData); req.end();
Response
HTTP Status code: 200 OK
Response body:
{
"resultType": 0,
"innerMessages": [],
"exception": null,
"actualObjectDN": "CN=MYCOMPUTER,OU=Computers,DC=example,DC=com",
"extraInfo": {}
}