SetEncryptionState
Will enable BitLocker encryption on the specified volume or system volume. Uses TPM + Numeric Password key protectors with XTS-AES 128 encryption algorithm. Encrypts used sectors only.
Syntax
Method ID
#define WAAPI_MID_SET_ENCRYPTION_STATE 1033
JSON Input Structure
{
"input": {
"method": 1033,
"signature": number,
"volumes": [
string,
...
]
}
}
Input Properties
| Parameter | Type | Description |
|---|---|---|
volumes | array<string> | Array of drive letters to encrypt (e.g., ['C:', 'D:']). |
JSON Output Structure
{
"result": {
"method": 1033,
"code": number,
"timing": number,
"timestamp": string,
"disk_encryption": [
{
"volume": string,
"code": number,
"recovery_password": string,
"key_protector_id": string,
"protection_state": string,
"conversion_status": string,
"encryption_method": string,
"error_message": string
},
...
]
}
}
Output Properties
| Property | Type | Description |
|---|---|---|
result.method | number | The method ID that generated this result. |
result.code | number | The result code. See Result Codes. |
result.timing | number | The measured time for the method call in milliseconds. |
result.timestamp | string | The timestamp in seconds of when the call was made. |
result.disk_encryption | array<object> | Array of encryption results, one per volume processed. |
result.disk_encryption.volume | string | The volume that was encrypted (e.g., 'C:', 'D:'). |
result.disk_encryption.code | number | The result code for this specific volume (0 for success). |
result.disk_encryption.recovery_password | string | (optional) The numeric recovery password for the encrypted volume. Format: XXXXXX-XXXXXX-XXXXXX-XXXXXX-XXXXXX-XXXXXX-XXXXXX-XXXXXX. |
result.disk_encryption.key_protector_id | string | (optional) The unique identifier for the key protector. |
result.disk_encryption.protection_state | string | (optional) The protection state of the volume (e.g., 'on', 'off'). |
result.disk_encryption.conversion_status | string | (optional) The conversion status of the volume (e.g., 'fully_decrypted', 'fully_encrypted', 'used_space_only_encrypted', 'encryption_in_progress', 'decryption_in_progress'). |
result.disk_encryption.encryption_method | string | (optional) The encryption algorithm used (e.g., 'XTS-AES 128'). |
result.disk_encryption.error_message | string | (optional) Error message if encryption failed for this volume. |
Result Codes
| Code | Name | Description |
|---|---|---|
| 0 | WAAPI_OK | The operation completed successfully. |
note
Other codes may be returned. See the full Result Codes reference for the complete list.
Remarks
Error Handling
The results of this function are determined by the error code returned by the call. If successful, WAAPI_OK or a special success code will be returned. Always check both the function return value and the result.code field in the output JSON.
Examples
Examples will be added here demonstrating the usage of this method.
See Also
Last updated: 2026-10-01